-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArithmeticExpressions2.java
More file actions
36 lines (31 loc) · 991 Bytes
/
ArithmeticExpressions2.java
File metadata and controls
36 lines (31 loc) · 991 Bytes
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
class ArithmeticExpressions2 extends ConsoleProgram {
/**
* Program that calculates the cost of internet for a year
* Inputs - The cost of the plan per month
* Calculations - How much it would cost per year
* - How much would it cost after taxes
* Outputs - Cost per year after taxes
* Variables
* Number of months - integer
* Cost per month - double
* Taxes - double
* Total - double
*/
public void run() {
// Variables
double dblCost;
double dblTax;
double dblTotal;
double dblSubTotal;
// Inputs
dblCost = readDouble("How much does your plan cost per month? ");
// Processing
dblSubTotal = dblCost * 12;
dblTax = dblSubTotal * 0.13;
dblTotal = dblSubTotal + dblTax;
// Output
System.out.println("The subtotal is: "+ dblSubTotal);
System.out.println("The tax is: "+ dblTax);
System.out.println("The final total for the year is: "+dblTotal);
}
}