Question
The MarsX Space Vehicles Company has been very successful. Due to an increase in demand for its STSs, the company had to hire thousands of
The MarsX Space Vehicles Company has been very successful. Due to an increase in demand for its STSs, the company had to hire thousands of scientists, engineers and staff from all over the world. As we all know, not all countries use the same system of measurements. The U.S., Liberia and Burma use the English system; while the rest of the world uses the metric system. In addition scientists use specific scales for some of their applications. To avoid confusion among team members from different countries, the company has commissioned the development and deployment of conversion applications. Your job is to write a program that interchangeably converts between different temperature scales (Celsius, Fahrenheit and Kelvin).
Your job depends on the success of this application. Therefore, make sure you write clean code and test it thoroughly.
Your program must do the following:
- Display the menu below and get user input. Re-display the menu until the user enters 4.
- Convert from Celsius
- Convert from Fahrenheit
- Convert from Kelvin
- Quit Program
- If the user enters 1, prompt the user to enter 3 numbers that represent temperatures expressed in degree Celsius. The program must then convert the temperatures to degree Fahrenheit and Kelvin and output them in a table as follows:
Celsius | Fahrenheit | Kelvin |
-10.00 | 14.00 | 263.15 |
0.00 | 32.00 | 273.15 |
100.00 | 212.00 | 373.15 |
- If the user enters 2, prompt the user to enter 3 numbers that represent temperatures expressed in degree Fahrenheit. The program should then convert the temperatures to degree Celsius and Kelvin and output them in a table as follows:
Fahrenheit | Celsius | Kelvin |
-10.00 | -23.33 | 249.82 |
0.00 | -17.78 | 255.37 |
100.00 | 37.78 | 310.93 |
- If the user enters 3, prompt the user to enter 3 numbers that represent temperatures expressed in degree Kelvin (no negative numbers allowed, validate). The program should then convert the temperatures to degree Fahrenheit and Celsius and output them in a table as follows:
Kelvin | Fahrenheit | Celsius |
0.00 | -459.67 | -273.15 |
100.00 | -279.67 | -173.15 |
1000.00 | 1340.33 | 726.85 |
- If the user enters 4, quit the program.
Needed conversion formulas:
From | To | Formula |
Celsius | Fahrenheit | F = C * (9.0/5.0) + 32 |
Celsius | Kelvin | K = C + 273.15 |
Fahrenheit | Celsius | C = (F 32) * (5.0/9.0) |
Fahrenheit | Kelvin | K = (F + 459.67) * (5.0 /9.0) |
Kelvin | Fahrenheit | F = K * (9.0/5.0) 459.67 |
Kelvin | Celsius | C = K 273.15 |
Your program must comply with the following constraints:
- Must declare at least the following 4 function prototypes:
int getMenuSelection(); /*Displays menu and gets user selection*/
void convertFromCelsius(); /*From Celsius to the other scales*/
void convertFromFahrenheit(); /*From Fahrenheit to the other scales*/
void convertFromKelvin(); /*From Kelvin to the other scales*/
- The main function must look exactly as shown below:
int main()
{
int menuSelection = 0;
do
{
system(cls);
menuSelection = getMenuSelection();
switch (menuSelection)
{
case 1: convertFromCelsius();
break;
case 2: convertFromFahrenheit();
break;
case 3: convertFromKelvin ();
break;
case 4: break; /*Do nothing. Exit Condition*/
default: printf(Please enter a number between 1 and 4 );
system(pause);
}
} while (menuSelection != 4);
system(pause);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started