1.Create a console program that will perform the following:
•Ask the user to enter five (5) grades
•Compute the average of the grades
•Round of the average using method of Math class
2. Name the project as ComputeAverageApp and the class as ComputeAverageProgram.
Example output:
Enter 5 grades separated by new Line.
90
83
87
98
93
The average is 90.2 and round off to 90.
Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of π. The program should use PI and the functions listed in Table 6-1 to accomplish the following:
A(n) ___ function doesn't return a value.
Layered
Int
Prototype
Void
Two of the main reasons for using functions are "divide and conquer" and "code reuse."
True
False
Function prototypes are placed below main(), while function definitions are placed above main()
True
False
A function prototype looks similar to the function ___, except there is a semicolon at the end.
Arguments
Body
Call
Header
Int's are not the only data type that can be passed to a function. All valid data types, such as double, char, bool, string, etc. can be passed.
Ask the user to enter their first name and last name in main(). Pass those values to a function and produce the last two lines of output shown below:
Output:
Enter your first name: [user types: Mary Jo]
Enter your last name: [user types: De Arazoza]
Your full name is: Mary Jo De Arazoza
Your name can also be written as: De Arazoza, Mary Jo
This is a twist on the previous exercise that will help you review loops and decision structures. You will again ask the user to enter two numbers. However, you will ALWAYS subtract the smaller number from the larger number to ensure that you never get a negative number for an answer. You do this by checking the numbers and switching them if they are not in the right order (larger then smaller). All of this checking, switching, subtracting, and output of the answer should occur in a function.
Finally, ask the user if they would like to run the program again. By now, you should know exactly what type of loop to use.
Output:
Enter two integers (separated by a space) and this program will subtract the smaller from the larger: [user enters: 7 5]
7 - 5 = 2
Do you want to run this program again? [user enters: y]
Enter two integers (separated by a space) and this program will subtract the smaller from the larger: [user enters: 5 7]
7 - 5 = 2
Do you want to run this program again? [user enters: n]
This is another easy exercise to test your knowledge of the fundamentals. In main(), ask the user to enter two integers. Pass those two integers to a function that will subtract one number from another. This function must also output the answer to the user.
Output:
Enter two integers (separated by a space) and this program will subtract them: [user enters: 5 7]
5 - 7 = -2
Create two functions (with appropriate names) that produce the output below. Both functions must use a prototype. All that should be present in main() is the call to these two functions and a blank line of output between the function calls.
This is a very easy exercise. Focus on the fundamentals. Make sure you review my solution file to make sure your syntax and name choice is good.
Output:
This is the first part of my program.
It was created with a function. <-- These two lines are output by the first function
This is the second part of my program.
It was created with a different function. <-- These two lines are output by the second function