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

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, nandalabella06
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
image
Engineering, 04.07.2019 18:10, wyattlb97
Water at the rate of 1 kg/s is forced through a tube with a 2.5 cm inner diameter. the inlet water temperature is 15°c, and the outlet water temperature is 50°c. the tube wall temperature is 14°c higher than the local water temperature all along the length of the tube. what is the length of the tube?
Answers: 3
image
Engineering, 04.07.2019 18:10, oliviasoreo92
Compute the pressure drop of 30°c air flowing with a mean velocity of 8 m/s in a circular sheet-metal duct 300 mm in diameter and 15 m long. use a friction factor, f 0.02, and pair = 1.1644 kg/m a. 37.26 pa b. 25.27 pa n c. 29.34 pa d. 30.52 pa
Answers: 1
image
Engineering, 04.07.2019 18:10, jojoangelique13
The flow rate of air through a through a pipe is 0.02 m5/s. a pitot static tube is placed in the flow. the radius of the pitot static tube is 1 mm. assuming the flow to be steady and the air to be at 300k, calculate the difference in total and static pressure if the diameter of the pipe is: (a) d 0.1 m d 0.05 m (c) d 0.01 m
Answers: 2
You know the right answer?
Implement the following integer methods:

a)method Celsius return the Celsius equivalent...

Questions in other subjects: