You will do part of this exercise by yourself. You MAY do some of this exercise with a partner.
This exercise will let you practice creating new objects and adding member variables and methods to classes.
Total possible: 70 points.
In this program, we’re writing a grading application for a hypothetical school class. In this class, each student is a member of one or more named teams. The teams are given grades for the work they submit. A student’s average is the average of all the grades given to each of the teams of which that student is a member.
The system will also track the number of absences each student has.
The interface for this program is entirely text based. This will give you an idea of how the program should work. The green text is what the user inputs, the black text is the output of the program:
Welcome to Team gradebook. Enter commands. Type 'exit' to end. add-student Steve ok add-student Anne ok add-student Carlo ok add-team TeamSA Steve Anne ok add-team TeamAC Anne Carlo ok add-grade TeamSA 90 ok add-grade TeamAC 80 ok get-average Steve 90 get-average Carlo 80 get-average Anne 85 exit
The good news is that the difficulty of dealing with the text based input and output of the program has all been done for you. All you’ll have to write is the code to update the program’s grade information.
To solve this problem, you’ll use 3 classes. The instances of the Student class will keep each student’s name and grades. The instances of the Team class will keep track of each team’s name and the students in that team. The TeamGradebook class will store a list of all the students and a list of all the Teams.
To make things work, you’ll need to write code for the following commands:
Some additional details and hints are provided in the comments of the methods themselves.
Unit tests for these methods have been provided, although there’s a limited amount that can be tested until get-average works.
For this part, you can work with a single partner. Both you and your partner should make clear who you worked with in the comments so there’s no issue of cheating. Also, although you can work together and help each other – your code for the individual part should not be identical. As a result, you may have to write slightly different code for the Paired Part.
If you want you can also work alone for this part.
Here’s what you should do:
Implicit adds for add-team. It can be sort of annoying to have to use add-student for each student when they have to be on a team anyway. So change the behavior of add-team to, if given a student name that isn’t found, just create the student.
get-best-team: returns the team name with the overall best TEAM average. Note, this is different than the team with the members with the best average (e.g., two students might score really high when working together, but when working on other teams they do poorly). Implement this by writing the handleBestTeam method in TeamGradebook.java plus anything you need to add in the Student and Team classes.
Example:
Welcome to Team gradebook. Enter commands. Type 'exit' to end. add-team Team1 Amy Bob ok add-team Team2 Bob Cindy ok add-grade Team1 80 ok add-grade Team2 90 ok get-average Cindy 90 get-best-team Team2