class apples{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
System.out.println("Select one of the following (absolute,ceil,floor,max,min,power,squareroot): ");
String code = scan.nextLine();
if (code.contains("absolute"));
System.out.println("Enter a number to get absolute value: ");
double num1 = scan.nextDouble();
System.out.println(Math.abs(num1));
}
}
Hey, this is the question I have, I want to be able to output and/or input a decimal value, but I keep getting errors, how come?
1
Expert's answer
2012-11-13T07:49:57-0500
you should use comma when you enter data. For example: "1,2" - correct "1.2" - not correct
Comments
Leave a comment