Assuming that the user inputs a value of 30 for the price and 10 for the discount rate in the following code snippet, what is the output?
Scanner in = new Scanner(System.in) ;
System.out.print("Enter the price: ") ;
Double price = in.nextDouble() ;
System.out.print("Enter the discount rate: ") ;
Double discount = in.nextDouble() ;
System.out.print("The new price is ") ;
System.out.println(price - price * (discount / 100.0) ) ;
A) The new price is 30
B) The new price is 20
C) The new price is 27.0
D) The new price is 33.0
Correct Answer:
Verified
Q24: What is the meaning of x =
Q37: Which one of the following is a
Q40: Which one of the following reserved words
Q82: What is wrong with the following code
Q83: What is wrong with the following code
Q84: What is the result of the following
Q85: In an airline reservation system, the cost
Q88: Which of the following statements places input
Q90: What are the values of num1 and
Q95: Which one of the following types of
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents