Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Visual Studio (.cpp file) Write a program that reads a type of metal, a density, a radius, and a height from a file named

In Visual Studio (.cpp file) Write a program that reads a type of metal, a density, a radius, and a height from a file named metals.txt. This file must be created and placed in the appropriate location so that your program can use it as an input file. The program will then compute and display the volumes and masses of two shapes, a sphere and a cone, made out of the specified metal with the specified dimensions. In addition to recalling that an objects mass is equal to its volume times its density, youll need these formulas: Volume of a sphere: = 4 3 3 , where r is the spheres radius Volume of a cone: = 2 3 , where r is the cones radius and h is its height For , use the value 3.14159. Note that although this program gets input from a file, it displays its output on the screen. A sample run is shown below, assuming that the file named metals.txt contains the following text and numbers: aluminum 2.70 5.27 10.2. The three numbers listed here represent aluminums density (in grams per cubic centimeter), a radius (in centimeters), and a height (in centimeters). Test your program thoroughly, using the values from the sample run and using other values of your own invention to make sure that all parts of your program work correctly.

**Your output should look exactly as shown below, including spelling, punctuation, capitalization, spacing, and number format.

For a sphere made of aluminum with radius = 5.27 cm:

Volume = 613.08 cubic centimeters

Mass = 1655.33 grams

For a cone made of aluminum with radius = 5.27 cm and height = 10.20 cm:

Volume = 296.65 cubic centimeters

Mass = 800.96 grams**

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Design Operation And Evaluation Of Mobile Communications

Authors: Gavriel Salvendy ,June Wei

1st Edition

3030770249, 978-3030770242

More Books

Students also viewed these Programming questions

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

How can NAFTA be beneficial to suppliers of Walmart?

Answered: 1 week ago

Question

=+a. What is the 84th percentile?

Answered: 1 week ago