Reputation: 43
How do you pass an objects reference to another method in another class?
The goal of my program is to calculate the students GPA from a file containing their transcript. There are 3 classes involved for the part I am struggling with.
There is the GPACalculator, which contains main. There is the transcript and course classes. the transcript class reads the file and builds a course out of it.
So far I have the transcript class with a method to read current line of the transcript file and construct a course object out of this information.
I now need to be able to send the course object to the main method of the gpa calculator so i can print it to the terminal window. This is where I am stuck.
Thanks
Upvotes: 0
Views: 966
Reputation: 1052
GPA calculator probably needs to make a new course object:
CourseObject courseobject = new CourseObject(args);
Then you need to do something like: courseobject.getData();
Upvotes: 1