StudentGrade Project


Create a java project using the usual naming (you can assume you will always create one for every homework unless explicitly told otherwise).  Include a class with main where you can test your other classes

Part A

Create a class StudentGrade.  Give it instance variables for: a classwork average, a homework average, and a test grade.  Include all these values in the toString

Add a method showGrade, which displays (this means prints)  an overall weighted average, using the following weighting:

classwork 50% homework 40% final test 10%.

[EC+15] Add a method findMinFinal.  In this method, using the weightings given, first find what weighted average they'd have in the class without the final test.  Based on this, report what grade they'd need on the final test to get an A in the class (hint: 90% is an A, think through the algebra and then write code to make java do the final calculation; java cannot do the algebra for you).  You don't have to do anything special about the case where they'd need a higher grade than they can possibly get, for instance if they'd need 300% on the final test to get an A, just report it. 

In your main, create at least two StudentGrades, give them different values, and check that this much works.


Part B

Create a new class Student.  Give it instance variables for first and last names, and an instance variable grade, which is a StudentGrade (not an int, not a String, not a double, a StudentGrade).  In the toString, include both the names and the grade. 

☑ Add a method aceFinal, which reports that the student aced the final test and sets their final test grade to 100 (think about where the final test grade lives and how you access it).

Add a method doEC, which reports that the student has done all the extra credit and adds 10 to their homework grade.  (This is not accurate for how our class works.)

Add a method skipClass, which reports that the student has skipped multiple classes and subtracts 10 from their classwork grade.  (This is not accurate for how our class works.)

In main, create at least two Students and test that all this works. 

Note that all these methods will blow up the program if you try to call them before giving the Student a StudentGrade, so think about what order to do things when you get to main.


Part C 

In Student, add an instance variable studyBuddy, of type Student.  Also add a method helpOut, which adds 5 to the studyBuddy's classwork average (not mine, my buddy's).

Note that this method will also blow up the program if you try to use it before giving the Student a StudentGrade.

In main, write code to represent the following situation, trying to reflect how it is written as closely as you can in code:

 Vex and Vax are students, and are each other's study buddy. Vex got Bs in all parts of the class, while Vax got B's on classwork but D's on homework.   Vax's study buddy did all the extra credit.  Vax's study buddy's study buddy often skipped class, but aced the final test.  Vex's study buddy's study buddy's study buddy did their best to help out. 

Also display their final grades.