-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChecksUsedPrice.java
41 lines (36 loc) · 1.17 KB
/
ChecksUsedPrice.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
/*Chapter 3 Challenge 15*/
import javax.swing.JOptionPane;
public class ChecksUsedPrice
{
public static void main(String[] args)
{
//Declare Variables
String checkSt;
int checks;
double checkA, checkB, checkC, checkD, totalA, totalB, totalC, totalD;
//Print prompts and get input
checkSt=JOptionPane.showInputDialog(null,"Enter the amount of checks you used: ");
checks = Integer.parseInt(checkSt);
//Outputs
if (checks<21){
checkA = checks*.10;
totalA = checkA+10;
System.out.println("Your Service fee is $" + totalA + "!");
}
else if (checks<40){
checkB = checks*.08;
totalB = checkB+10;
System.out.println("Your Service fee is $" + totalB + "!");
}
else if (checks<60){
checkC = checks*.06;
totalC = checkC+10;
System.out.println("Your Service fee is $" + totalC + "!");
}
else {
checkD = checks*.04;
totalD = checkD+10;
System.out.println("Your Service fee is $" + totalD + "!");
}
}
}