Package temperatureconverter

Source Code of temperatureconverter.Main

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package temperatureconverter;

import java.util.Scanner;
import java.text.DecimalFormat;

/**
*
* @author nikolajsobolev
*/
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);
        System.out.print("Hello! This is the temperature converter.\nPlease input the temperature value (Celsius degrees): ");
        Float celsius = new Float(keyboard.nextFloat());
        System.out.println(celsius + " Celsius degrees equals to:\n" +
                new DecimalFormat("#.##").format(9/5F * celsius + 32) + " Fahrenheit degrees\n" +
                new DecimalFormat("#.##").format(celsius + 273) + " Kelvin degrees");
        //В идеале - предоставить возможность выбора конвертируемой шкалы и шкалы, в которую конвертируем.
    }
}
TOP

Related Classes of temperatureconverter.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.