-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUIAssignment.java
32 lines (27 loc) · 1.15 KB
/
GUIAssignment.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
import javax.swing.JOptionPane;
public class GUIAssignment
{
public static void main (String[] args)
{
String name;
String course;
String space;
String units;
String rate;
String misc;
double amount;
double total;
name = JOptionPane.showInputDialog(null, "Name: ");
course = JOptionPane.showInputDialog(null, "Course: ");
units = JOptionPane.showInputDialog(null, "Units: ");
rate = JOptionPane.showInputDialog(null, "Rate: ");
misc = JOptionPane.showInputDialog(null, "Misc: ");
amount = Double.parseDouble(units) * Double.parseDouble(rate);
total = amount + Double.parseDouble(misc);
JOptionPane.showMessageDialog (null, "Name:" + name + "\nCourse" +course +
"\nNumber of Units: " + units + "\nRate: " + rate + "\nMisc: " + misc);
space = JOptionPane.showInputDialog (" ");
JOptionPane.showMessageDialog (null, "\n\n" + space + "\nName: " + name +
" " + "Course: " + course + "\nTuition Fee:" + amount + "\nTotal Amount:" + total + "\n" + space);
}
}