Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description and Given Info Write a public static method named FahrenheitToKelvin that will take a single argument of type double and will return a

Problem Description and Given Info

Write a public static method named FahrenheitToKelvin that will take a single argument of type double and will return a double. When called, and passed a temperature value (in Fahrenheit), this method must compute and return the Kelvin temperature equivalent. You must also write a small program in the main method that will:

prompt the user to enter a temperature value in Fahrenheit

collect and store the user's input in a double variable

call the FahrenheitToKelvin method, passing the user's input as an argument

store the value returned by the FahrenheitToKelvin method in another double variable

Display the Kelvin equivalent value as shown in the Examples below

Here are some examples of what the user should see when the program runs.

Example 1

Enter temperature in Fahrenheit : 100 100.00 degrees Fahrenheit is 310.93 Kelvin 

Example 2

Enter temperature in Fahrenheit : -20.25 -20.25 degrees Fahrenheit is 244.12 Kelvin 

For the given inputs, make sure that your program output looks exactly like the examples above (including spelling, capitalization, punctuation, spaces, and decimal points).

My code :

import java.util.Scanner; public class TempConversion {

static double FahrenheitToKelvin(double fahrenheit){ double Kelvin = 273.15 + ((fahrenheit-32.0)*(5.0/9.0)); return Kelvin; } public static void main(String[] args) { TempConversion object = new TempConversion(); Scanner keyboard = new Scanner(System.in); System.out.print("Input the temperature in Fahrenheit : "); double fahrenheit = keyboard.nextDouble(); double kelvin = FahrenheitToKelvin(fahrenheit); System.out.print(String.format("%.2f degrees Fahrenheit is %.2f Kelvin ", fahrenheit, kelvin)); } }

________________________________________________________________

I have only one mistake showing below

_________________________________________________________________

image text in transcribed

When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. ding trail of your work 1/20E0,0,0,0,0,00U0,0,0,0,0,0,0,30,30,30,30,30,80,80min:18 Total score: 80/100 Only show failing tests 1:Structure Test 01 0/20 FahrenheitToKelvin method has correct return type, name, and parameter list Test feedback FAIL - public static double FahrenheitTokelvin(double) method not found

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

3. An overview of the key behaviors is presented.

Answered: 1 week ago

Question

2. The model is credible to the trainees.

Answered: 1 week ago