67 257
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #16629 in Java | JSP | JSF for Ijan

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!

Comments

Assignment Expert
18.10.12, 14:27

You're welcome. We are glad to be helpful.
If you really liked our service please press like-button beside answer field. Thank you!

Ijan
17.10.12, 20:22

Hi, thank you so much admin...

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions