Question

In: Computer Science

Answer the questions below as indicated. Note that you have to complete these using Visual Studio...

Answer the questions below as indicated.

Note that you have to complete these using Visual Studio 2019.

Upload the source code (.cpp) of your applications. Upload a separate (.cpp) file for each question.

1-Create a C++ program which adds two numbers and displays the sum.

2-Create a C++ program which calculates and displays the area of a rectangle.

3-Create a C++ program which calculates and displays the average of four numbers..

4-Complete questions 3 of the chapter 3 Programming Exercises in pages 182 of the Textbook.

Upload your source codes to this link.

Solutions

Expert Solution

I don't have Visual Studio 2019 the program is the same only compile and running is different.

1- C++ program which adds two numbers and displays the sum

#include <iostream>
using namespace std;

//Declarating Num1/Num2 is an Integer
int addition(int Num1,int Num2);

int main()
{
        int Num1,Num2;
        int add;
        
        cout<<"Enter first number: ";
        cin>>Num1;
        cout<<"Enter second number: ";
        cin>>Num2;
        
        add=addition(Num1,Num2);
        
        cout<<"Sum of two number is: "<<add<<endl;
        
        return 0;
}
int addition(int Num1,int Num2)
{
        return (Num1+Num2);
}

Output:-

2- C++ program which calculates and displays the area of a rectangle.

#include <iostream>
using namespace std;

    int main()
    {
        int width, length, area;
                cout << "\n Find the Area of a Rectangle \n";     
        cout<<" Length of the rectangle : ";
        cin>>length;
                cout<<" Width of the rectangle : ";
        cin>>width;
        area=(length*width);
        cout<<" The area of the rectangle is : "<< area << endl;      
        cout << endl;
        return 0;
    }

Output:-

3- C++ program which calculates and displays the average of four numbers

#include<iostream>
using namespace std;
int main()
{

  double num1, num2, num3, num4;
  double sum, average;


  cout << "Enter Four Numbers :: ";
  cin >> num1 >> num2 >> num3>>num4;
  sum = num1 + num2 + num3 + num4;
  

  average = sum / 4;


  cout << "Sum = " << sum << endl;
  cout << "Average = " << average << endl;

  return 0;
}

there is no page 182.


Related Solutions

USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some...
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some time and still can't quite figure it out. I'm creating an app that has 2 textboxes, 1 for inputting customer name, and the second for entering the number of tickets the customer wants to purchase. There are 3 listboxes, the first with the days of the week, the second with 4 different theaters, and the third listbox is to display the customer name, number...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your solutions for each problem solved in a Word or Google document which includes (a) the pseudocode, (b) the C# codes and (c) the execution result (screen capture just the answer part using Snipping Tool, avoiding non-related or blank spaces). Notice for readability, that the (a) & (b) are in text mode and the (c) is in image mode. Use proper titles and wording in...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your solutions for each problem solved in a Word or Google document which includes (a) the pseudocode, (b) the C# codes and (c) the execution result (screen capture just the answer part using Snipping Tool, avoiding non-related or blank spaces). Notice for readability, that the (a) & (b) are in text mode and the (c) is in image mode. Use proper titles and wording in...
Answer the questions as indicated for scenarios 1-5. Note: You do not need to perform any...
Answer the questions as indicated for scenarios 1-5. Note: You do not need to perform any of the procedures indicated. Scenario 3: A guidance counselor identifies a random sample of 40 high school female students and gives each of these students a vocabulary test. For the female group, the average vocabulary score was 69 with a standard deviation of 5.3. Next, the guidance counselor takes a random sample of 48 male high school students. The male students also complete the...
Using these results, complete the table below and then use your results to answer the questions...
Using these results, complete the table below and then use your results to answer the questions that follow. (Please remember to round all answers to two decimal places: 0.00 at each step.) (23 points) X X-M (X-M)2 1 14 -15.85 251.22 2 16 -13.85 191.82 3 18 -11.85 140.42 4 20 -9.85 97.02 5 23 -6.85 46.92 6 23 -6.85 46.92 7 25 -4.85 23.52 8 27 -2.85 8.12 9 28 -1.85 3.42 10 29 -0.85 0.72 11 30 0.15...
Visual Studio Basic 1: Which string function you will be likely using to search for a...
Visual Studio Basic 1: Which string function you will be likely using to search for a certain pattern in a string? Describe your answer. 2: If you are to find the occurrence of 4-letter string “abcd” regardless of its case combinations, such as “AbCd”, “ABCd” and etc, in a long string, what would you do? Describe your answer.
Directions: Answer the questions below (taken from the Winston book) using the indicated data set. Submit...
Directions: Answer the questions below (taken from the Winston book) using the indicated data set. Submit this on Blackboard in this Word document by the due date indicated on Blackboard. Only submissions in this format will be accepted. This homework will rely heavily on a close reading of the assigned text. Please show all work! This is an abbreviated version in order to complete the full version. Date S and P return Dell return 1-Sep-88 0.042 0.282112845 1-Oct-88 0.027 0.1582397...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You will be simulating an ATM machine as much as possible Pretend you have an initial deposit of 1000.00. You will Prompt the user with a Main menu: Enter 1 to deposit Enter 2 to Withdraw Enter 3 to Print Balance Enter 4 to quit When the user enters 1 in the main menu, your program will prompt the user to enter the deposit amount....
Using Visual Studio Code (JavaScript) For this lab you must use a reasonable faceted search example,...
Using Visual Studio Code (JavaScript) For this lab you must use a reasonable faceted search example, each item must have at least three categorical attributes and at least one numeric attribute. Attributes such as ID, name etc do not count as categorical or numeric attributes. Exercise 1 (a) Define a class for your item that meets the above three categorical and one numeric attribute requirements. (b) Create a text file that contains at least 5 such records in CSV format....
For each of the questions below, choose the correct answer from the choices indicated (a), (b),...
For each of the questions below, choose the correct answer from the choices indicated (a), (b), (c) or (d). (1) Assuming one atom per lattice point, a Simple Cubic structure when heated transforms to a Body Centered Cubic (BCC) structure. Assuming that the atomic radii remain the same, its mass density will increase by: (a) 30%; (b) 9%; (c) 4%; (d) 23%. (2) Assuming one atom per lattice point, a Simple Cubic (SC) structure when heated transforms to a Face...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT