Sunday, August 24, 2014

DegreeConverter

Class Name: DegreeConverter. Develop a program that will convert Fahrenheit temperature into Celsius temperature. Enter desired Fahrenheit value. Use the formula: c=(f-32)/1.8.

import java.util.*;

public class DegreeConverter {
    public static void main (String []args){
        Scanner input = new Scanner(System.in);
       
        double c;
        System.out.print("Enter temperature(Fahrenheit): ");
        int temp = input.nextInt();
               
        c = (temp-32)/1.8;
       
        System.out.println("In Celsius: "+c);
    }
}







Observation:
It Converts Degree from Fahrenheit to Celsius.
Recommendation:
You really need to have the formula in converting degrees.

No comments:

Post a Comment

advertisement