Question
Write a program with reads a Celsius degree value from the console or a Fahrenheit degree value from the console , then converts it to
Write a program with reads a Celsius degree value from the console or a Fahrenheit degree value from the console , then converts it to Fahrenheit or Celsius and displays the result. The formulas for the conversion are as follows:
Fahrenheit = (9 / 5) * Celsius + 32
Celsius = (5/9) *(Fahrenheit -32)
I can write this program with ease using a If/Else statement, but we have to use a Switch/Case statement as well as a If/Else statement.
I know that I'll need a double for the conversion because it will have 9.0 or 5.0 to get the correct answer, but as you know, you cant use a double with a switch/case.
I've seen this part being used at the beginning but i'll need help understanding what it is because we have only learned public static void so far.
//public static double FahrenheitToCelsius(double fahrenheit)
I'd rather not use this way because i have not learned it yet.
Also please keep it simple, i'm only in chapter 3 of this intro to java programming 1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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