Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Class list (String adding-on upon doing while loop.
- // Outputs all of the Strings being saved during the while loop.
- int counter = 1, total;
- String name, names="";
- total = Integer.parseInt(JOptionPane.showInputDialog("Enter total number of students"));
- while (counter<=total)
- {
- name = JOptionPane.showInputDialog("Enter student's name");
- names += name + "\n";
- counter++;
- }
- JOptionPane.showMessageDialog(null,"Class is full");
- JOptionPane.showMessageDialog(null,"Class list below: " + "\n" + names);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement