Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Java) Java selection structure. Write a Java program that reads in a temperature in either degrees Fahrenheit, Celsius, or Kelvin and converts the temperature to

(Java) Java selection structure.

Write a Java program that reads in a temperature in either degrees Fahrenheit, Celsius, or Kelvin and converts the temperature to the other two formats. Your program will ask for a single character representing the degree to be converted (F, C, K for the 3 types of measurements) and a number representing the temperature. If the input temperature code is not one of F, C, or K, issue an error message and end the code. If the input temperature value is not within -700 to 700 degrees, inclusive, issue an error message and end the code.

Tempature Conversion:

C = (F - 32) * 5/9 K = (F + 459.67) * 5/9 F = C * 9/5 + 32 K = (9/5 * C + 491.67) * 5/9 F = 9/5 * K 459.67 C = (491.67 9/5 * K) * 5 / 9

SAMPLE RUN:

Enter the degree conversion code: X INVALID code Enter the degree conversion code: F Enter the temperature value in degrees Fahrenheit: 900 INVALID value for temperature

Enter the degree conversion code: F Enter the temperature value in degrees Fahrenheit: 100 Temperature in degrees Celsius: 37.77 Celsius Temperature in degrees Kelvin: 310.92 Kelvin

Enter the degree conversion code: K Enter the temperature value in degrees Kelvin: 100 Temperature in degrees Celsius: -173.15 Celsius Temperature in degrees Kelvin: -279.67 Fahrenheit

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

Find Depth first DFT and Breadth first BFT

Answered: 1 week ago

Question

=+How should it be delivered?

Answered: 1 week ago

Question

=+4 How does one acquire a global mindset?

Answered: 1 week ago