Sunday, June 30, 2019

Fahrenheit to Celsius in Java

A program that I wrote for my book Introduction to Java Programming that is exclusively published by Mindshapers Inc. here is the website of my publisher https://mindshaperspublishing.com/

This program will convert a temperature from Fahrenheit to Celsius using Java programming language.

Write a program that will ask the user to give the temperature in  Fahrenheit and the program will convert the given temperature in Celsius and display the result on the screen.


If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

package temperature_converter;
/**
 * Addition_Numbers.java
 * @author Jake Rodriguez Pomperada,MAED-IT
 * February 17, 2019  Sunday
 * http://www.jakerpomperada.com
 * jakerpomperada@gmail.com 
 * Bacolod City, Negros Occidental
 */
import java.util.*;
import java.text.DecimalFormat;

public class Temperature_Converter {
     public static void main(String[] args) {
        double  temperature;
        double  display;
         Scanner in = new Scanner(System.in);
        DecimalFormat df = new DecimalFormat("#.##"); 
        System.out.println();
        System.out.print("\t\tTemperature Converter");
        System.out.println("\n");
        System.out.print("\tGive temperature in Fahrenheit : ");
        temperature = in.nextInt();
        temperature = ((temperature - 32)*5)/9;
        display = Double.valueOf(df.format(temperature));
        System.out.println();
        System.out.print("\tThe temperature in Celsius = " + display+"\u00B0C");
        System.out.println("\n");
        System.out.print("\tEnd of Program");
        System.out.println("\n");
   }
    
}



No comments:

Post a Comment