Question
using Java, strings and conditional if/else/elsif/endif statements and excluding modules. and including the algorithm... Second: Rewrite the temperature program to allow the user to enter
using Java, strings and conditional if/else/elsif/endif statements and excluding modules. and including the algorithm...
Second: Rewrite the temperature program to allow the user to enter in either a Fahrenheit or a Celsius entry. Also allow the user to enter either a floating point number or an integer. Use the formats XXXXX T. Where XXXXX is the number entered and the T is one of [ F, f, C, or c ] to indicate the input temperature scale. The program would then convert to the opposite scale. When you write your program you may assume the user will input their data in the correct format.
For this problem, after the user has typed in their temperature and scale, ON A SINGLE LINE and separated by a space, use the Scanner to retrieve first the floating point number then the single character string.
If I were to enter 32.0 F the program would return "32.00 Fahrenheit is equal to 0.00 Celsius" (Note: The output numbers may not exceed 2 decimal places)
If I were to enter 32.0 C the program would return "32.00 Celsius is equal to 89.60 Fahrenheit"
Example: Please enter your temperature, Real number, followed by a space and the scale c or C for Celsius and f or F for Fahrenheit.
33.0 f 33.0 Fahrenheit is equal to 0.56 Celsius
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