-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSalaryDialog.java
23 lines (23 loc) · 893 Bytes
/
SalaryDialog.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import javax.swing.JOptionPane;
public class SalaryDialog
{
public static void main(String[] args)
{
String wageString, dependentsString;
double wage, weeklyPay;
int dependents;
final double HOURS_IN_WEEK = 37.5;
wageString = JOptionPane.showInputDialog(null,
"Enter employee's hourly wage", "Salary dialog 1",
JOptionPane.INFORMATION_MESSAGE);
weeklyPay = Double.parseDouble(wageString) *
HOURS_IN_WEEK;
dependentsString = JOptionPane.showInputDialog(null,
"How many dependents?", "Salary dialog 2",
JOptionPane.QUESTION_MESSAGE);
dependents = Integer.parseInt(dependentsString);
JOptionPane.showMessageDialog(null, "Weekly salary is $" +
weeklyPay + "\nDeductions will be made for " +
dependents + " dependents");
}
}