grodek118

Restaurant Bill

Aug 31st, 2022
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner keyboard = new Scanner(System.in);
  10.  
  11.         double mealCharge;
  12.         double taxAmount;
  13.         double tipAmount;
  14.         double totalBill;
  15.  
  16.         System.out.println("Enter the charge of the meal");
  17.         mealCharge = keyboard.nextDouble();
  18.  
  19.         taxAmount = mealCharge * 0.0675;
  20.         tipAmount = mealCharge * 0.20;
  21.         totalBill = mealCharge + taxAmount + tipAmount;
  22.  
  23.         System.out.println("Meal charge: " + mealCharge);
  24.         System.out.println("Tax amount: " + taxAmount);
  25.         System.out.println("Tip amount: " + tipAmount);
  26.         System.out.println("Total bill: " + totalBill);
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment