Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Space X Space Vehicles Company has been very successful. Due to an increase in demand for its STSs, the company had to hire thousands

The Space X 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:

  1. Display the menu below and get user input. Re-display the menu until the user enters 4.

  1. Convert from Celsius
  2. Convert from Fahrenheit
  3. Convert from Kelvin
  4. Quit Program

  1. 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

  1. 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

  1. 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

  1. 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:

  1. Must declare the following 4 methods:

int getMenuSelection(); /*Displays menu and gets user selection*/

void convertFromCelsius(); /*From Celsius to the other scales and display results*/

void convertFromFahrenheit(); /*From Fahrenheit to the other scales and display results*/ */

void convertFromKelvin(); /*From Kelvin to the other scales and display results*/

  1. The main function must look exactly as shown below:

public static void main(String[] args) {

int menuSelection = 0;

do {

menuSelection = getMenuSelection();

switch (menuSelection) {

case 1: convertFromCelsius();

break;

case 2: convertFromFahrenheit();

break;

case 3: convertFromKelvin ();

break;

case 4: break; /*Do nothing. Exit Condition*/

default: System.out.println(Please enter a number between 1 and 4);

}

} while (menuSelection != 4);

}

Please do in java

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

International Baccalaureate Computer Science HL And SL Option A Databases Part I Basic Concepts

Authors: H Sarah Shakibi PhD

1st Edition

1542457084, 978-1542457088

More Books

Students also viewed these Databases questions