Reputation: 7
What can I do to appear a dialog box asking the user to enter the number of students... (the highlighted part)![enter image description here][1]
JOptionPane.showMessageDialog(null, "Welcome");
JOptionPane.showMessageDialog(null, "Students mark Input Project");
JOptionPane.showMessageDialog(null, "In this program the user is going to enter the students name, class and marks.Then the program is going to output several information about each student.");
JOptionPane.showMessageDialog(null, "Class Information must be entered as the name of the class, the subject and the number of students");
String nameofclass = JOptionPane.showInputDialog("Enter the name of the class");
String nameofsubject = JOptionPane.showInputDialog("Enter the subject");
int numberofstudents =Integer.parseInt("Enter the number of students");
JOptionPane.showMessageDialog(null,"Class Students Information");
JOptionPane.showMessageDialog(null,"You must enter the name, surname and " + nameofsubject + " marks for each and every student in class "+ nameofclass);
StLuciaClassrooms theclass =new StLuciaClassrooms(nameofclass, numberofstudents);
theclass.enterInformation(numberofstudents);//
Upvotes: 0
Views: 1461
Reputation: 3140
try this
int numberofstudents =Integer.parseInt(JOptionPane.showInputDialog("Enter the number of students"));
Upvotes: 1