Question: There are several different methods for measuring volume. For instance, you can measure volume in cm3, liters, quarts, and gallons. You could write several functions

There are several different methods for measuring volume. For instance, you can measure volume in cm3, liters, quarts, and gallons. You could write several functions to compute back and forth between these four scales. However, for this exercise, you will write a single function to convert a single value from any of the four scales to any of the other four scales. To support this, you will need to define an enumerated type called Volume that enumerates the following four scales: CM, LITER, QUART, GALLON. You will then use this enumerated type and implement the following function: int convert Volume(double *cm, double 'liter, double *quart, double "gallon, Volume scale): Place your enum declaration and the prototype declaration in a file called hw04p5.h Place your actual function implementation in a file called hw04p5.c Create a main function in volumeDemo.c that prompts the user for one of the scales and a value to convert and outputs the result, of all four scales (Just use this to test your function, do not hand it in.) Look online for a volume conversion table The return value will be a flag indicating an error-level: 0 for no error, 1 for an error (negative values), and 2 for a NULL pointer error. Define an enumerated type named Error to implement, this. Enter a volume: 257.50 Enter scale (G, C, L, Q): L Conversion: 257.50 Liters 68.02 Gallons 257500 Cubic Centimeters 272.10 Quarts Please write the code using c programming
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
