subject
Engineering, 17.03.2020 22:10 hokamidat

Implement the following integer methods:

a)method Celsius return the Celsius equivalent of a Fahrenheit temperature, using the calculation
Celsius = 5.0/9.0*(Fahrenheit -32);

b) method Fahrenheit returns the Fahrenheit equivalent of a Celsius temperature, using the calculation
Fahrenheit = 9.0/5.0*(Celsius +32);

c)use the method from part (a) and (b) to write an application the enables the user either to enter a Fahrenheit temperature and display the Celsius equivalent or enter a Celsius temperature and display the Fahrenheit equivalent

This is the software program and the problem I am having is that I cannot get the program to give me the correct answer!

// Exercise 6.22: Convert. java
// Use a method to write an application to enable the user
// Either to enter a Fahrenheit and Celsius equivalent
// Or enter a Celsius temperature and display the Fahrenheit
// program use scanner class
import java. util. Scanner;

public class Convert
{
// convert temperatures
public void ConvertTemperature()
{
Scanner input = new Scanner( System. in );
double convert;
int selection;
double temp;
double converts;

do
{
// print and prompt for input from user
System. out. println("");
System. out. println( "Main Menu" );
System. out. println( "Enter 1 for Fahrenheit to Celsius equivalent " );
System. out. println( "Enter 2 for Celsius to Fahrenheit equivalent" );
System. out. println( "3 to Exit\n " );
System. out. print( "Selection: " );
selection = input. nextInt();

// converts celsius to fahrenheit
// converts fahrenheit to celsius

switch ( selection )
{
case 1:
System. out. println("Enter fahrenheit temperature: " );
temp = input. nextInt();
convert = celsius( temp );
System. out. printf("%f degrees F = %f degrees C\n",temp, convert );
break;

case 2:
System. out. println("Enter celsius temperature: " );
temp = input. nextInt();
converts = fahrenheit( temp );
System. out. printf("%f degrees C = %f degrees F\n", temp, converts );
break;

case 3:
break;

default:
System. out. println( "Invalid selection" );

} // end of switch
} while( selection != 3);
} // end of convertTemperatures
public static double fahrenheit(double celsius)
{
double fahrenheit;
fahrenheit = 9 / 5 * (celsius + 32);

return fahrenheit;
}

public static double celsius(double fahrenheit)
{
double celsius;
celsius = 5 / 9 * (fahrenheit - 32);

return celsius;
}

}

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
The mass flow rate of the fluid remains constant in all steady flow process. a)- true b)- false
Answers: 1
question
Engineering, 04.07.2019 18:10
Adouble-strand no. 60 roller chain is used to transmit power between a 13-tooth driving sprocket rotating at 300 rev/min and a 52-tooth driven sprocket. a) what is the allowable horsepower of this drive? b) estimate the center-to-center distance if the chain length is 82 pitches. c) estimate the torque and bending force on the driving shaft by the chain if the actual horsepower transmitted is 30 percent less than the corrected (allowable) power.
Answers: 3
question
Engineering, 04.07.2019 18:10
Calculate the bore of a cylinder that has a stroke of 18 inches and an extension time of 6 seconds at a flow rate of 4 gal/min.
Answers: 3
question
Engineering, 04.07.2019 18:20
Refrigerant-134a enters the compressor of a refrigerator as superheated vapor at 0.14 mpa and -10°c at a rate of 0.05 ka/s and leaves at 0.8 mpa and 50°c. the refrigerant is cooied in the condenser to 0.72 mpa and 26'c. it is then throttled to 0.15 mpa. sketch the t-s diagram for the system and evaluate: 6) the rate of heat removai from the refrigerated space (kw), it) the power input to the compressor (kw), ii) the isentropic efficiency of the compressor (%), and iv) the cop of the refrigerator.
Answers: 2
You know the right answer?
Implement the following integer methods:

a)method Celsius return the Celsius equivalent...
Questions
question
Mathematics, 07.01.2021 05:20
question
Biology, 07.01.2021 05:20
question
Mathematics, 07.01.2021 05:20
Questions on the website: 13722367