The program: Write a class called Student (classes start with a capital letter by convention). For reference, you can look at the demo that is available on the s: drive. Your Student class should have the following:

Data: 5 data fields (which should all be private):

  • a String called name
  • an int called age
  • a char called gender
  • a double called gpa
  • a boolean called onScholarship

Constructors: 2 overloaded constructors (means: same name, different number/type of arguments)

  • A default constructor (receives no arguments) that does not do anything ( just has { } ). Normally, the default constructor would be used to set the data to default values (like John Doe), but I want you to see what values Java will assign if we do not set them ourselves.
  • A parameterized constructor which receives 5 arguments in this order:
    • a String which it will set its name field to
    • an int which it will set its age field to
    • a char which it will set its gender field to
    • a double which it will set its gpa field to
    • a boolean which it will set its onScholarship field to

Methods: 6 methods (which should be public)

  • A method called getAge(). It will receive nothing and return the age.
  • A method called setGPA. It will receive a new GPA (as a double) and set the real GPA to whatever is received. It returns nothing.
  • A method called setOnScholarship. It will receive a boolean value and will set the real onScholarship data field to whatever is passed in. It returns nothing.
  • A method called toString. This method will receive no arguments and return a String with all of the information for whatever Student instance is told to return its toString. The String it should return should be made up of:
< its name>< tab>< its age>< tab>< its gender>< tab>< its gpa>< tab>< onScholarship>
  • A method called onProbation. This method will receive no arguments and return a boolean. It will return true if the Students onScholarship field is true and the Students gpa is < 2.0. Otherwise, it returns false.
  • A method called complain. This method will receive no arguments and return a String. The String will be any complaint that you want your Student instance to say about anything.

Testing your class: I will provide a class called StudentDriver. It will have a main method, so it can be compiled and also run. When using it, be sure it is in the same directory as your It should compile if your Student class is set up correctly (methods are defined correctly and the arguments are in the correct order).

Look carefully at It creates instances of Student and then tells them to do things. When you run it, make sure you understand the results.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.