It's not a secret anymore!*
The moose likes Beginning Java and the fly likes possible help, if you have the time ;-( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "possible help, if you have the time ;-(" Watch "possible help, if you have the time ;-(" New topic
Author

possible help, if you have the time ;-(

Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
This is what I have so far, and I only got this because someone was nice enough to help me.

I just don't think that I know what to do next. Thanks to anyone who has the time to help me.
Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
This is the rest of the assignment, if anyone understands how to pull from the MBAstudent class and then transfer everything to the MBAstatus class, I would sure would love the help.

Then create a class called MBAstudent. This class has two variables: gpa and gmat, and inherits from Student. Create a default constructor and a non-default constructor. The class should have a method to check if the input for first name and last name is valid, for example, it should be a string with length greater than zero.
The method checkQualification returns true if gpa is greater or equal 3.0 and gmat is greater than or equal 550. If gpa or gmat is not provided, admitted will have a false value. Create all needed get and set methods for this class as well. The range: 0<=gpa<=4.0, 0<=gmat<=800.
Create an implementation class called MBAstatus. This could use Label, TextField, TextArea, or JOptionPane components that get the first name, last name, social security number, gpa, and gmat, and uses them to create a student object, and gets its admitted status and shows it back to the user. Include the following functions: 1. For getting the information from the user, to create the MBAstudent object, and to determine the admitted status and to put it back to the screen. 2. For clearing the TextFields and TextArea if used.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
You should be able to create a MBAstudent class based on what you've learned so far with your Student class and its variables and constructors.

Let's see that first and then we can proceed to the MBAstatus class which will use the other two classes.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
This is what I have for the MBAstudent class, but I am stuck here. I am suppose to have different checks to make sure that the info is legit, but I don't know when to put it in or where and I don't know how much more code is suppose to be here.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Notice that your MBAstudent class should "inherit from", i.e. "extend" the Student class.

Also, if you want your class to do something, like check the input for example, you need to have a method. You could call your method something like "checkName()".

The method will take in the name String that you are checking as a parameter and use a method from the String class to see whether that String has a length greater than zero.

The assignment also states that you need another (second) method named checkQualification which returns a boolean. Inside that method, you will check if the variable "gpa" contains a value which is > or = to 3.0. You also need to check the gmat value as the requirements of the assignment state. If both of these conditions are true, then you will return the boolean value "true".

You also need get and set methods similar to the ones in the Student class.

You have a nice start. You need to go a little farther with this class.
Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
This is what I have done to the program so far, but when I try to compile I get a lot of errors. Help me!!!
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
gpa = new float();
float and int are primitives. You don't need to instantiate them to use them. In fact, you can't instantiate primitives as they aren't objects.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: possible help, if you have the time ;-(