Calculate and display the weight n of the object on that


Programming Assignment

Objective: Become more familiar with C++ I/O, computations in C++, and the C++ development environment you are using for this class.

Description: Write a program that calculates the weight of an object on the Earth, Moon, and Mars. Specifically, your final program will choose from a menu to determine the gravity (m/s2) an object is on, then will read the mass of the object (kg), then calculate and display the weight (N) of the object on that body.

Useful information:

W = mg

Body g(m/s2)
Earth 9.81
Moon 1.63
Mars 3.71

1. Display standard output information using the ShowProgramHeader () function to print your required output information. (Remember to call

2. Display body choice menu.

3. Prompt user for body (input).

4. Read body choice (a number is probably easiest).

5. Prompt user for the mass of the object (input).

6. Read the mass.

7. Calculate the weight (body dependent).

8. Print input values and mass (show all units).

Deliverables:
- Program-fully documented.
- Output:
    - Show intermediate steps in the development of your program.

    - Test your final program using at least three different values for the mass; 10, 50, and 250 kg.

Sample calculation sheet: In addition to your program and output, attach a page showing your sample calculation. These sample calculations should be done before you start programming and used as a minimal set of test cases for your program.

Part -2:

Objective Become familiar with the C++ compiler/environment that you plan to use for the programming assignments in this class. I strongly recommend using the Unix system as we discussed in class.

Requirements:

- Get the "Hello, world!" program working.
- Add a function (ShowProgramHeader 0 as described in lecture) to print your name and class information before the "Hello, world!" message.

Note: This will be required on all future assignments.

The following changes should generate compiler errors/warnings. If it does, record the message; if it does not, record that. 'Dim this record in with your assignment.

- Remove the semi-colon from the output statement in main().
- Comment out the using namespace std; statement. Use either a block comment or an in-line comment. Is there a difference?
- Comment out the #include Costream> (#include on older compilers) statement. Use either a block comment or an in-line
comment. Is there a difference?
- Change the double quotes that enclose the Hello, world! message to single quotes.
- Change the << (put to operator) to < on one of your output lines.
- Remove the starting brace from main().
- Remove the closing brace from main0.
- Change tout to Gout or COUT.
- Change main to Main or MAIN.

Change the name of the function that displays your name, date, etc, from ShowProgramHeader() to ShowHeader().

Deliverables

Program-fully documented.

Output-neatly formatted and documented.

List of errors-neatly formatted

 

Solution Preview :

Prepared by a verified Expert
Programming Languages: Calculate and display the weight n of the object on that
Reference No:- TGS01483715

Now Priced at $45 (50% Discount)

Recommended (93%)

Rated (4.5/5)