I have a project and I don't understand what the instructions want me to do. Can someone explain them better...? I don't understand constructors, objects, and methods very well but I am trying my best to do this project (i am a bit amazed how i got the highest grade on the test (33/35))...

Add a service  class to the project named Student.  This program will encapsulate the concept of  a student, assuming a  student has the following attributes (instance variables): a name, a social security number and a GPA (e.g.,  3.5).  For the Student class you will write the constructors, accessors and mutators, and toString and equals  methods.  In the client application class you will instantiate student class objects and write statements  (method calls)  to test the methods in your student service class

All i need is for someone to help me with re-reading the instructions in a different way... I should be able to do the rest by myself. I am trying to get a hold of my instructor to send me better instructions but he hasn't responded for a couple of days (this is his new instructions (above)) so i am getting new instructions, if he gives it...

Thanks guys.

Recommended Answers

All 5 Replies

There are any number of books and online articles that will help you understand object-oriented programming and methods. Anyway, which of these concepts don't you understand, and what do you think you know about them?

commented: good suggestion. +4

Now accrding to your instructor,there will be a class Student with constructors that can set value of instance variables.

Now you have to make your instance variables private so that it is not accessible directly oustside the class.Create accessors and mutators to access instance variables. (The role of accessors and mutators are to return and set the values of an object's state.An accessor method is used to return the value of a private field.A mutator method is used to set a value of a private field.).Override toString and equals method and perform some action.

commented: nice +4

There are any number of books and online articles that will help you understand object-oriented programming and methods. Anyway, which of these concepts don't you understand, and what do you think you know about them?

I understand what they are (the basics) but the problem is that i can't apply my thinking towards some of the concepts, i overthink them. So far, i have been really been messing up with methods/constructors/objects.

@IIM, i am going to play around with that for a little bit, i am going to see how well i can follow your instructions (they sound easier at least/luckily).

what i felt from the instructions :

  1. create a student class
  2. write the private instance variables
  3. overload the default constructor with social security number and GPA arguments
  4. write the public getters/setters etc , and also , override toString() and equals()
  5. then write a main method ( this is your test client )
  6. create new instances of students inside main, passing in social security number , GPA etc feilds in the constructor itself
  7. print them out in any manner you like.

So, all great suggestions (even my own...). :-)

In any case, start by decomposing your 1 point statement:

  1. Add a service class to the project named Student. This program will encapsulate the concept of a student, assuming a student has the following attributes (instance variables): a name, a social security number and a GPA (e.g., 3.5). For the Student class you will write the constructors, accessors and mutators, and toString and equals methods. In the client application class you will instantiate student class objects and write statements (method calls) to test the methods in your student service class

To this:

  1. Add a service class to the project named Student.
  2. This program (class) will encapsulate the concept of a student, assuming a student has the following attributes (instance variables): a name, a social security number and a GPA (e.g., 3.5). IE, member variables of name, ssn, gpa, etc.
  3. Implement the methods specified (constructors, assignment methods, getter methods, toString method, etc).
  4. Create an application (he calls this a class, but that can be optional) that creates objects of the Student class with appropriate data, and then manipulates that data, and finally outputs that data (toString) to validate that the actions you took are correct.

My most common bit of advice to my junior colleages is always to "simplify, simplify, simplify"... :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.