Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

13 Problem: Construct and run a C program to develop a metric conversion chart t

ID: 3877100 • Letter: 1

Question

13 Problem: Construct and run a C program to develop a metric conversion chart that will do the following conversions Given a quantity in: 1. Inches 2. Ounces 3. Pints 4. Fahrenheit Calculate the equivalent value in: Centimeters Grams Litres Celsius Requirements Declare Inches, Ounces, Pints and Fahrenheit as data type int Declare Centimeters, Grams, Litres and Celsius as data type double Format all double variables with two places after the decimal. (1) (2) Use the following conversion chart 1 inch 2.54 cm 1 ounce= 28 1 pint = 0.571 F 32) * 5/9°C (3) Use the following for a test case 2 inches 4 ounces 9 pints 220 °F assignl.cpp (4) Save the source file as (5) Print the source file (6) E-mail the source file Sample Output: Input value for inches: 2 The value in centimeters is: 5.08 Input value for ounces: 4 The value in grams is: 112.80 Input value for pints: 9 The value in litres is: 5.13 Input value for fahrenheit: 226 The value in celsius is: 104.44 ress any key to continue E-Mail and Print the C+source code.

Explanation / Answer

#include <iostream>
#include <iomanip>

using namespace std;

int main() {

// declaring variables

int inches, ounces, pints, fahrenheit;
double centimeters, grams, litres, celcius;
  
double f = 2.12345;

// user Input
cout << "Input value for inches: ";
cin >> inches;

// conversion
centimeters = inches * 2.54;

// output
cout << "The value in centimeters is: " ;
printf("%.2lf",centimeters) ;

cout<< endl << endl << "Input value for ounces: ";
cin >> ounces;
grams = 28*ounces;
cout << "The value in grams is: ";
printf("%.2lf",grams) ;

cout<< endl << endl << "Input value for pints: ";
cin >> pints;
litres = 0.571*pints;
cout << "The value in litres is: ";
printf("%.2lf",litres) ;

cout<< endl << endl << "Input value for fahrenheit: ";
cin >> fahrenheit;
celcius = (fahrenheit-32)*5/9.0;
cout << "The value in celcius is: ";
printf("%.2lf",celcius) ;
}

/*SAMPLE OUTPUT

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote