|
|
|
All right, here is the my very first java console program.
This program takes a number from the user (saying that it is a degree in fahrenheit) and converts it to a degree in celcius.
lots of fun! lol just joking. Well here's the code!
//Name of Program File: Celcius
//Author: Travis McGrath
//INFO140 Section # 04 Date: Sept 24, 2001
//Your Company Name: Fahrenheit Conversions.co
//Description: This program will take a degree in fahrenheit and convert it to
// celcius
public class Celsius
{
//Main method
public static void main(String[]args)
{
//prompt user to enter fahrenheit
System.out.print("Enter the number that you want converted from fahrenheit" +
" to celsius, for example 30 or -30: ");
double fahrenheit = MyInput.readDouble();
//calculate conversion
double Celsius = (5.0/9)*(fahrenheit - 32);
//display results
System.out.println(" " + fahrenheit + " degrees in fahrenheit converted " +
"to celsius is: " + Celsius + "degrees.");
}//end main
}//end class
|