232k views
2 votes
Assuming that the user inputs a value of 25 for the price and a value of 10 for the discount rate in the following code snippet, what is the output? import java.util.Scanner; public class determinePrice { public static void main(String[] args){ 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.println("The new price is " + (price - price * (discount / 100.0))); } }

1 Answer

1 vote

Answer:

The output of the following question:

The new price is 22.5

Step-by-step explanation:

When you execute that java program, Firstly, the program will ask for "Enter the price " after input the price 25 as per the question, than it ask "Enter the discount rate " after input the discount rate, after that the program shows an output after calculating the formula which is "(price - price * (discount / 100.0))",

User Gatlanticus
by
5.5k points