Answer:
Written in Java
import javax.swing.JOptionPane;
public class Decision{
public static void main(String[] args) {
int i = 1;
while(i<=5){
String score = JOptionPane.showInputDialog("Input <score>");
int mark = Integer.parseInt(firstNumber);
if(mark >= 50 && mark <= 100) {
JOptionPane.showMessageDialog(null, mark, " is a pass", JOptionPane.PLAIN_MESSAGE);
}
else{
JOptionPane.showMessageDialog(null, mark, " is a fail", JOptionPane.PLAIN_MESSAGE);
}
i++;
}
}
}
Explanation:
This initializes the a counter variable i to 1
int i = 1;
The following iteration is repeated as long as i is less than or equal to 5
while(i<=5){
This prompts user for input
String score = JOptionPane.showInputDialog("Input <score>");
This converts user input to integer
int mark = Integer.parseInt(firstNumber);
This checks if input is within 50 and 100 (inclusive)
if(mark >= 50 && mark <= 100) {
This prints pass
JOptionPane.showMessageDialog(null, mark, " is a pass", JOptionPane.PLAIN_MESSAGE);
}
If otherwise
else{
This prints fail
JOptionPane.showMessageDialog(null, mark, " is a fail", JOptionPane.PLAIN_MESSAGE);
}
This increments the counter variable by 1
i++;
}