Joptio pane not correctly outputting stored values. (Help please)
Below is the code im having issues with it compiles fine and runs , but as i put in information in the joptionpane box with option 1)init and try to
display it with option 2) listinformation it pops up the error that "no students entered".
What I want it do is list all the students , gpas , and need with a JOptionPane.showMessageDialog
Please please help.
hid , solved
Re: Joptio pane not correctly outputting stored values. (Help please)
Please post your code in code tags. You can learn how here, and then you can edit your post and add them.
The init() method is set up to keep track of the number of students entered, but the returned value 'count' is not stored by the calling statement. It's discarded. Since it is discarded, the program has no indication that student info has been entered or how many. To store the count value returned by init(), change the calling statement to:
Now, as for your design, using parallel arrays to store data is the path to ruin. Instead, create a Student class and store all of the necessary characteristics in fields in the Student objects. If you can and would like to pursue this approach, let us know. Perhaps this is a stepping stone and your not allowed to make the step to a Student class yet. If so, I understand.
numStudent = init(firstname,lastname, gpa, need, numStudent );