Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / writing a C++ program:Skills Needed: Computing Basic Geometric Formulas cin, cout, constants, arithmetic expressions, rounding, int main, meaningful variable names, spacing, indentation, documentation, output

writing a C++ program:Skills Needed: Computing Basic Geometric Formulas cin, cout, constants, arithmetic expressions, rounding, int main, meaningful variable names, spacing, indentation, documentation, output

Computer Science

writing a C++ program:Skills Needed: Computing Basic Geometric Formulas cin, cout, constants, arithmetic expressions, rounding, int main, meaningful variable names, spacing, indentation, documentation, output.Create a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimeters) specified as a floating point value. The program then echoes the input and computes areas of squares and circles and the volume of a cube. For the squares, you will assume that the input length value is the length of a side. For the circles, this same value becomes the diameter. Use the meter value input to calculate the results in square (or cubic) meters and then print the answers in square (or cubic) meters.

  1. Area of a square (length times width)
  2. Area of a circle (pi times radius squared)
  3. How much bigger the area of the square is than the circle (see previous calculations)
  4. Round the length down to the next whole number of meters, then compute the volume of a cube with this value as the length of its side
  5. Round the length up to the next whole number of meters, then compute the volume of a cube with this value as the length of its side.

You are to run the program THREE times using the following input values:

  1. 1000
  2. 1999.9
  3. 299.4

Please turn in the program and the outputs of running the program three times as directed. Be sure to use good style, appropriate comments and make use of constants in this program.

Important Notes

  • For the constant PI, please use 3.14159
  • Use the floor() and ceil() functions to round down and up respectively. For example, ceil(3.02) is 4.
  • Be sure to #include <cmath> to get access to these two functions
  • Be sure to #include <iomanip> to print out the exact number of decimals using setprecision.

Sample Output

Your output format should look similar in style to this example below.

 

Geometry formulas by (Your name)

Enter one floating point number for length, 123.4

 

The number you entered is 123.4 cm or xx.xxxx m. (where xx.xxxx is 1.2300)

Area of square xx.xxxxxxx sq. m.

Area of a circle xx.xxxxxxx sq. m.

Difference is xx.xxxxxxxx sq. m.

 

Cube volume rounded down is xx.xxxxxxxx cu. m.

Cube volume rounded up is xx.xxxxxxxx cu. m.

Press any key to continue

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions