It is currently Mon May 20, 2013 11:17 am

All times are UTC - 5 hours [ DST ]




 Page 1 of 1 [ 1 post ] 
#1) 
Author Message
 Post subject: JAVA: Program to convert temperature from fahrenheit to celcius
PostPosted: Sun Feb 22, 2009 3:23 pm 

Joined: Sat Aug 23, 2008 9:08 pm
Posts: 1674
/**
 * Program to convert temperature from fahrenheit to celcius.
 *
 * @author (MrK)
 * @version (v1.0, Feb 10 ,09)
 */
import java.util.Scanner;
public class tempInF
{
    public static void main(String [] args)
    {
        Scanner keyIn = new Scanner(System.in);
        double tempf, tempc;
        String city;
        System.out.println("Programmer: MrK");
        System.out.println("Course:     COSC 111, Winter 2009");
        System.out.println("Exam#:      1");
        System.out.println("Due Date: 2-10-09\n");
        System.out.print("Enter the name of the city: ");
        city = keyIn.nextLine();
        System.out.print("\nEnter the temperature in degrees Fahrenheit: ");
        tempf = keyIn.nextInt();
        tempc = (5.0 / 9.0) * (tempf - 32) ;
        System.out.printf("\nTemperature in %s is %.1f degrees Celsius", city, tempc);
    }
}


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 1 post ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: