-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContribution.java
More file actions
28 lines (22 loc) · 878 Bytes
/
Contribution.java
File metadata and controls
28 lines (22 loc) · 878 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
//Contribution.java
// This program calculates the amount of pay that
// will be contributed to a retirement plan if 5%,
// 8%, or 10% of monthly pay is withheld.
public class Contribution
{
public static void main(String[] args)
{
//Variables to hold the monthly pay and the amount of contribution.
double monthlyPay = 6000.0;
double contribution;
//Calculate and display a 5% contribution
contribution = monthlyPay * 0.05;
System.out.println("5 percent is $" + contribution + " per month.");
//Calculate and display an 8% contribution.
contribution = monthlyPay * 0.08;
System.out.println("8 percent is $" + contribution + " per month.");
//Calculate and display an 10% contribution.
contribution = monthlyPay * 0.10;
System.out.println("10 percent is $" + contribution + " per month.");
}
}