Colorado State University

Recitation R19 - Classes, Objects, Methods
Spring 2015

CS160: Foundations in Programming

The goal of this lab is:

Classes, Objects, Methods

Write the following program from scratch in the following phases:

Phase 1

  1. Create a new project in Eclipse called R19.
  2. Import the class called Course.java.
  3. Import the class called Student.java.
  4. The main method in Student.java has already been completed for you.
  5. Implement the readTranscript method to read the student's transcript from a file, as follows:


Phase 2

  1. Implement the writeTranscript method to write the student transcript to the console:
        public void writeTranscript() { }
        
  2. To write the transcript, print the student information from instance variables, then iterate the courses array, and calling toString on each Course object. After completing the loop, print the grade point average. The output for the provided file should be exactly as follows:
        Name: Chris Wilcox
        SID: 888-88-8888
        EID: sinyala
    
        Spring 2014, CW100, Using Google, 4.0, 3.0
        Fall 2014, CW101, Telemark Skiing, 4.0, 2.5
        Spring 2015, CW200, Whitewater Kayaking, 3.0, 4.0
        Fall 2015, CW201, Making Chai, 3.0, 4.0
        Spring 2016, CW300, Working Hard, 2.0, 2.0
        GPA: 3.125
        
  3. Note: See how the student excels at important subjects!

Phase 3

  1. Implement the gradePointAverage method to compute the grade point average of the student:
        public double gradePointAverage() { }
        
  2. The algorithm to compute the grade point average is to accumulate the product of the course grade and credit hours for each course, then divide that number by the total number of credit hours.
  3. This method must be called from the writeTranscript method before printing the last line of the transcript where the GPA is reported.

Submit your Student.java to the Checkin tab to get credit for this lab. Automated grading will be enabled, and your final grade will be based on your results.

© 2015 CS160 Colorado State University. All Rights Reserved.