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 following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
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...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store...
C# ( asp.net ) 2019 Visual Studio I have a dropdown where you can select (...
C# ( asp.net ) 2019 Visual Studio I have a dropdown where you can select ( integer, string, date ) After selecting the desired dropdown option, user can input a list of inputs. For example; for integer: 2,5,7,9,1,3,4 And then , I have a 'sort' button Can you please help me with the code behind for sorting them( For integer, string, and date ) Thank you.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT