Hey guys, my Professor want us to come up with this code:
Create a class called Student. This class should have the following twelve private data elements:
String studentName
String studentEmail
String studentLocation
int projectGrade1
int projectGrade2
int projectGrade3
int projectGrade4
int quizGrade1
int quizGrade2
int finalExam
int participationGrades
This class should have the following public methods:
A get method for each data element. For example:
public String getStudentName(); // note that the variable name starts with a lowercase, but in the method it’s uppercased.
A set method for each data element. For example:
public void setStudentName(String name);
public double finalGrade(); // computes final grade: project grades each * 0.1, plus quiz grades each * .05, plus final exam grade * .25, plus participation grade * .25.
public void studentReport(); // prints to the screen a reportcard that shows the student’s name, contact information, grade for each assignment, and final grade. (this method should call finalGrade() directly to get the actual final grade value!)
Your project code will NOT have a main() method. You project must compile to create a file Student.class.
The below driver program will be used to test your class. Note that this should be compiled as a separate file named gradeBookDriver.java. Do NOT modify gradeBookDriver; make your Student class meet the specified API so that the supplied gradeBookDriver works as-is.
public class gradeBookDriver {
public static void main (String[] args) {
Student cmis141Student1 = new Student();
Student cmis141Student2 = new Student();
cmis141Student1.setStudentName("Andy");
cmis141Student1.setStudentEmail("andy@hotmail.com");
cmis141Student1.setStudentLocation("UK");
cmis141Student1.setProjectGrade1(100);
cmis141Student1.setProjectGrade2(90);
cmis141Student1.setProjectGrade3(85);
cmis141Student1.setProjectGrade4(95);
cmis141Student1.setQuizGrade1(100);
cmis141Student1.setQuizGrade2(80);
cmis141Student1.setFinalExam(80);
cmis141Student1.setParticipationGrades(0);
cmis141Student2.setStudentName("Heather");
cmis141Student2.setStudentEmail("heather@hotmail.com");
cmis141Student2.setStudentLocation("Germany");
cmis141Student2.setProjectGrade1(100);
cmis141Student2.setProjectGrade2(95);
cmis141Student2.setProjectGrade3(95);
cmis141Student2.setProjectGrade4(65);
cmis141Student2.setQuizGrade1(80);
cmis141Student2.setQuizGrade2(90);
cmis141Student2.setFinalExam(85);
cmis141Student2.setParticipationGrades(90);
cmis141Student1.studentReport();
cmis141Student2.studentReport();
} // end of main() method
} // end of gradeBookDriver
Your output will look something like this:
------------------------------------------
Student: Andy
Location: UK
Contact information: andy@hotmail.com
Grade Report
------------------------------------------
Quiz 1 100
Quiz 2 80
Project 1 100
Project 2 90
Project 3 85
Project 4 95
Participation 0
Final Exam 80
-------
Final Grade: 66.0
------------------------------------------
------------------------------------------
Student: Heather
Location: Germany
Contact information: heather@hotmail.com
Grade Report
------------------------------------------
Quiz 1 80
Quiz 2 90
Project 1 100
Project 2 95
Project 3 95
Project 4 65
Participation 90
Final Exam 85
-------
Final Grade: 87.75
Im writing the code right now and will post what I have as I go. If anyone has a suggestion on the simplest way to do this please dont hestitate to share it with me.