Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

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:

  • Output the value of √π .
  • Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs the following:
  • The value of 4.0πr², which is the surface area of the sphere.
  • The value of (4.0/3.0)πr³, which is the volume of the sphere.

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


LATEST TUTORIALS
APPROVED BY CLIENTS