-
Notifications
You must be signed in to change notification settings - Fork 0
/
Atkins_M4PE2.java
44 lines (31 loc) · 1.01 KB
/
Atkins_M4PE2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//James Atkins
//M4PE2
//02-25-2021
//This program calculates the tip, tax, and total for a dine-in
package atkins_m4pe2;
import java.util.Scanner;
public class Atkins_M4PE2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
double food;
double tip;
double tax;
double total;
final double TAX_RATE = 0.07;
final double TIP_RATE = 0.15;
System.out.print("Enter the charge for the food. $");
food = keyboard.nextDouble();
//Calculates tip
tip = food * TIP_RATE;
//Calculates tax
tax = food * TAX_RATE;
//Calculates total
total = food + tip + tax;
System.out.println("Tip: $" + tip);
System.out.println("Tax: $" + tax);
System.out.println("Total: $" + total);
}
}