-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebugFive4.java
More file actions
32 lines (30 loc) · 1.04 KB
/
DebugFive4.java
File metadata and controls
32 lines (30 loc) · 1.04 KB
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
// DebugFive4.java
// Outputs highest of four numbers
import javax.swing.*;
public class DebugFive4
{
public static void main (String args[])
{
int one, two, three, four;
String str, output;
str = JOptionPane.showInputDialog(null,"Enter an integer");
one = Integer.parseInt();
str = JOptionPane.showInputDialog(null,"Enter an integer");
two = Integer.parseInt();
str = JOptionPane.showInputDialog(null,"Enter an integer");
two = Integer.parseInt();
str = JOptionPane.showInputDialog(null,"Enter an integer");
four = Integer.parseInt();
if(one > two & one >= three && one < four)
output = "Highest is " + one;
else
if(two > one || two > three && two > four)
output = "Highest is " + two;
else
if(three > one && three > two || three == four)
output = "Highest is " + three;
else
output = "Highest is " + three;
JOptionPane.showMessageDialog(null, output);
}
}