package algorithmsample7;
import java.util.Scanner;
/**
*
* @author Nurhak
*/
public class AlgorithmSample7 {
public static void main(String[] args) {
String data = "";
double dataInch = 0;
double dataCm = 0;
try {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter data (inch)");
data = scan.nextLine();
dataInch = Double.parseDouble(data);
dataCm = dataInch * 2.54;
System.out.println(dataInch + " inch equals to " + dataCm + " cm.");
} catch (Exception e) {
System.err.println("You probably entered a wrong value like a String value!");
}
}
}
Comments
Post a Comment