package temperature.conversions;
import java.util.Scanner;
public class TemperatureConversions
{
public static void main(String[] args)
{
double Selection;
Scanner input = new Scanner(System.in);
// create a menu to select item from
System.out.println("Welcome, to temperature conversion program select one of the options: ");
System.out.println("1.Convert to Celsius");
System.out.println("2.Convert to fahrenheit");
Selection = input.nextDouble();
if (Selection == 1)
{
System.out.println("Eneter temperature amount: ");
Selection = input.nextDouble();
double fahrenheit = celcious(Selection);
System.out.println("Celsius is: " + fahrenheit);
} // end of if statement
else
{
Selection = input.nextDouble();
System.out.println("Eneter temperature amount: ");
double celcious = fahrenheit(Selection);
System.out.println("celcious is: " + celcious);
} // end of else statement
} // end of main
/****** Method 1 Celcius *******/
public static double celcious(double Fahrenheit)
{
double Celcious = 9.0 /5.0 * Fahrenheit + 32.0;
return Celcious;
} // end of celcious method
/****** Method 2 Fahrenheit *******/
public static double fahrenheit(double Celsius)
{
double Fahrenheit = 5.0 / 9.0 * (Celsius - 32.0);
return Fahrenheit;
} // emd of fahrenheit double
}// end of TemperatureConversions class
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More