I'm trying to format the output where the name will occupy 25 columns and the GPA will occupy 10 and be displayed with one digit of precision in the system console in addition to outputting each student info in a message dialogue box. I am also trying to generate a random that will chose information for a student to be excused for a final exam and output it to the console.
I must ask why would you "mix" your application, so part of it uses Swing and part of it interacts with user over console? That's very bad approach in this case. Either choose first one and develop GUI application, or another and interact with user over console.
First of all, your default constructor in Student class is wrong. You are just declaring new variables (though with the same name as class fields) that are local to the constructor block, and your fields are left uninitialized.
On the other hand, to achieve output formatted as you want it to be, take a look at this tutorial. Also, check the API of Random class that you need for your last requirement.
Edit: And welcome to the Ranch!
The quieter you are, the more you are able to hear.
Joined: Oct 13, 2005
Agree with KS. I would say you ought to get rid of that no‑arguments constructor altogether. There is no such thing as a Student called Last. First, and even if there were they would never get a 4.0gpa. So you don’t want that constructor. You want to insist every Student have a name and gpa? All, right, only supply a constructor which takes name and gpa parameters.
And welcome again
I added code tags, which makes your code look a lot better, but highlights some indenting mistakes. Remind yourself about how to indent here or here (but not both; they are not mutually compatible).