Question #16629

Write a program that calculates the Total Price of value meal ordered. The Total Price must include the 8% Government tax. Get inputs from user, the type of value meal selected and the quantity ordered. Use if-else statement. Hints Gov tax = 0.08 x Price and Total Price = (Price x quantity) + Government Tax

Expert's answer

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

double TAX = 0.08;



System.out.println("Enter the price of a meal: ");

String price = in.nextLine();

System.out.println("Enter the quantity: ");

String quantity = in.nextLine();



double govTax = Double.parseDouble(price) * TAX;

double totalPrice = (Double.parseDouble(price) * Double.parseDouble(quantity)) +
govTax;



System.out.println("Total price: " + totalPrice);

}

}

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!

LATEST TUTORIALS
APPROVED BY CLIENTS