Calculate and display the weight of the object on that body

Assignment Help Programming Languages
Reference no: EM131105716

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 <iostream h> 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

 

Reference no: EM131105716

Questions Cloud

Resulting strategic responses to new stage : The U.S. Healthcare system is currently in a stage where consumer choices are re-shaping health care. What are the resulting strategic responses to this new stage? Do you work for an organization that is responding in any of these ways? Explain..
Analyze the potential benefit that a flat tax structure have : Analyze the potential benefits that a flat tax structure might have on both taxpayers and the United States Treasury. Defend or critique a flat tax structure.
The natural length of a spring : The natural length of a spring is 8.0 cm. A force of 12 N stretches it to a length of 10.0 cm. How much work is done in stretching it from a length of 10.0 cm to a length of 14.0 cm?
Eliminate shortages and stock outs : Why would not a company always store large quantities of inventory to eliminate shortages and stock outs?
Calculate and display the weight of the object on that body : Calculate and display the weight (N) of the object on that body - Objective Become familiar with the C++ compiler/environment that you plan to use for the programming assignments in this class
Does the research by art laffer have no income tax perform : Does the research by Art Laffer and other economists suggest that over time states that have no income tax perform better than states with high-income taxes? Why? Does a flat tax make more sense from a taxation standpoint?
Key opportunities and threats in external environment : In Module 2, we focus on SWOT. In order to complete a SWOT, we are required to identify and analyze the key opportunities and threats in the external environment. Then, we need to identify and analyze the company's key strengths and weaknesses (in..
Explain how law and ethics are different : Explain how both individuals and institutions can be viewed as ethical or unethical. Give an example of each. Explain how law and ethics are different, and why a good reputation can be more important than legal compliance.
Hobart beverage company uses the weighted-average : Hobart Beverage Company uses the weighted-average method in its process costing system. Materials are included at the start of the production process but conversion costs are uniformly applied throughout the production process.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write statement that calls add to compute sum of sales

Add is a method that accepts two int arguments and returns their sum. Write a statement that calls add to compute the sum of euroSales and asiaSales and that stores this value in eurasiaSales .

  Prepare an algorithm that detects spam email

In this homework, your goal is to devise an algorithm that detects spam email. This homework is quite long but I belive you will find this addictive

  Explain simple javascript event

Modify the body tag of your page to include the onLoad event handler. Within the event handler call the MyLoadFunction().

  What are advantages of using menus in a gui application

What are advantages of using menus in a GUI application? Design a menu structure for a program you would find useful in your work or hobbies. Write and post the code for the menu creation

  Compute average of values contained in integer

Compute the average (as a double) of values contained in integer variables num1, num2, num3 and allot that average to double variable avg.

  Write a prolog program that finds the ast item in a list

Write a Prolog program that finds the ast item in a list. Add a test query.

  Create program by using pseudocode along with structure

Create a program by using pseudocode along with structure to do the following. Permit the user to enter series of temperatures in degrees Celsius (C) terminated by -999.

  Historical principle for loss to the company is minimal

A colleague of yours frequently takes small amounts of office supplies, noting that the loss to the company is minimal. Your rationale expresses which historical principle?

  Develop application for company having breakdown of payroll

Develop the logic for application for company which wishes report containing breakdown of payroll by department. Input comprises each employee's name, department number.

  Write program which reads in weight in pounds and ounces

Write the program which reads in the weight in pounds and ounces and putputs equivalent weight in kilograms and grams. Utilize at least three functions.

  Describe the necessary formulas and sample calculations

Demonstrates your thought process and steps used to analyze the problem. Be sure to include the required input and output and how you will obtain the required output from the given input

  Advantages of turning the atm switches into lsr

Under these conditions, what are the advantages, if any, of turning the ATMswitches into LSRs, as opposed to using an overlay network?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd