Question
CSIS 113B Lab 10 - Methods For this assignment you are going to write methods that convert a temperature given in Fahrenheit to other temperature
CSIS 113B Lab 10 - Methods
For this assignment you are going to write methods that convert a temperature given in Fahrenheit to other temperature types. To do this you will need three separate methods. They are as follows:
C2F - Converts Celsius to Fahrenheit.
K2F - Converts Kelvin to Fahrenheit
N2F - Converts Newtons to Fahrenheit
Each of the above methods should take as an argument a double value which holds the temperature to be converted. These methods should also return a double value which holds the value converted to Fahrenheit. Make sure that you name these methods as outlined above. Remember, 35% of your grade is for following the directions.
The following is required for your three functions
Input - Temperature to be converted
Process - Convert value to Fahrenheit using the appropriate equation
Output - Temperature converted to Fahrenheit
NOTE:
To get the input your are probably going to want to take in the expression as a String and then parse it. You can parse the string by using the split method that is built into the string. To use the split method you need to specify a character to split on. For this program you are going to want to split on the space character. The split method will return an array of words that have been separated by the space.
String input = in.nextLine(); String[] parsed = input.split(" "); value = Integer.parseInt(parsed[0]); function = parsed[1]; function = function.toUpperCase();
In the above code if you typed in 32 C the value 32 would be placed inside value and "C" would be placed inside the String function.
Your program should run like the following:
run: This temperature conversion program converts other temperature types to Fahrenheit The temperature types are: C Celcius K Kelvin NNewton To use the converter you must input a value and one of the temparture types For example 32 C converts 32 degress from Celsius to Fahrenheit Please enter a value and it's type to be converted 32 32.0C is 89. in Fahrenheit Please enter a value and it's type to be converted 45 k 45.0K is -378.6699999999999 in Fahrenheit Please enter a value and it's type to be converted Thanks for using the Converter BUILD SUCCESSFUL (total time: 27 seconds)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