Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Java program, including the IPO and algorithm , for a temperature conversion program that will allow the user to enter in an input temperature

Write Java program, including the IPO and algorithm, for a temperature conversion program that will allow the user to enter in an input temperature in one scale and then a target scale to convert to. The program would then convert to the target scale. EG If I were to enter 32.0 Fahrenheit as my input temperature and Kelvin as my target scale the program would return 32.0 degrees Fahrenheit is equal to 273.15 degrees Kelvin. Your program must support conversion to and from the following scales.

Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Raumur (Reaumur), Rmer (Romer)

The user must enter the actual name of the scale not a letter or a number from a menu. Your program must validate that the user has entered a correctly spelled name for the scale. You may use Reaumur for Raumur and Romer for Rmer.

You will need the temperature conversion formulas from the following site.

https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature (Links to an external site.)

Your program must validate that the user has entered a proper scale for both the input scale and the target scale. Your program must also validate that the user has not entered a temperature that is below absolute zero. You can find the temperatures for absolute zero for each of the scales at the above web site.

Your program must allow the user to repeat this program as many times as they would like.

Your program must use at least the following method with the signature. - getTemperatureScale():String This method prompts the user for the name of the scale and returns a valid scale name.

HINTS!!!!!

  • Convert from the input scale into an intermediate scale, such as the Kelvin or Celsius scales, and then from that scale to the target scale. That will avoid converting directly from each scale into every other scale.
  • When validating for absolute zero, first convert to the intermediate scale. That will avoid the need of directly checking for absolute zero in every scale.
  • Use additional methods as needed to break up the program into small logical modules.

Example run:

Please enter a temperature:

-333.3

Please enter your temperature scale:

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

myown

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

Celsius

That temperature is below absolute zero, and therefore is invalid.

You need to enter a temperature that is greater than or equal to absolute zero.

Please enter a temperature:

33.0

Please enter your temperature scale:

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

myown

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

Fahrenheit

Please enter your target temperature scale:

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

myown

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

Celsius

You entered 33.0 degrees Fahrenheit, which is equal to 0.56 degrees Celsius.

Would you like to enter another temperature?

Please enter Y for yes or N for No.

b

Please enter Y for yes or N for No.

Y

Please enter a temperature:

33.0

Please enter your temperature scale:

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

Celsius

Please enter your target temperature scale:

Please enter Fahrenheit, Celsius, Kelvin, Rankine, Delisle, Newton, Roaumur, or Romer

Fahrenheit

You entered 33.0 degrees Celsius, which is equal to 91.4 degrees Fahrenheit.

Would you like to enter another temperature?

Please enter Y for yes or N for No.

n

Good-Bye!!

Biggest thing: including the IPO and algorithm

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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions