64 584
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #18527 in Java | JSP | JSF for Gjert

Question #18527
import java.util.Scanner;

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?
Expert's answer
you should use comma when you enter data.
For example:
"1,2" - correct
"1.2" - not correct

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions