Details:
Create a new project in eclipse as a before. Name this one again using
your first initial and last name and then Lab3. So mine would be
jsantoreLab3
Now add a new class to your project in eclipse. Call this class StudentTester
Put the following code into the StudentTester class:
========================the class code is below=====================
import java.util.Scanner;
public class StudentTester
{
public static void main(String[] args)
{
//Student testStudent = new Student(123);//this students id is 123
Scanner reader = new Scanner (System.in);
System.out.print("What is the students Exam grade (out of 100):");
int userValue = reader.nextInt();
// testStudent.setExamGrade(userValue);
System.out.print("What is the students Project grade (out of 100):");
userValue = reader.nextInt();
// testStudent.setProjectGrade(userValue);
System.out.print("What is the students Quiz grade (out of 100):");
userValue = reader.nextInt();
// testStudent.setQuizGrade(userValue);
//I've added a bogus starting value for final grade to make things
// compile until the students have their student class made up.
double finalGrade = 0.0;
// finalGrade = testStudent.calculateGrade();
System.out.println("The student's grade is "+finalGrade);
}
}
====================the class code is above=================
you will find several lines commented out, you will want to remove the
comments on the lines that call methods from the student class after
you implement the student class.
Now add a second new class to your project. In this class, implement the class defined in the UML diagram below:
The methods in this class must behave as follows
- The Student Constructor should use its parameter to initialize the studentID property
- The calculate grade should take the examGrade, projectGrade and
QuizGrade properties (consider them to be out of 100) and use the
formula for calculating your grade listed in your syllabus to come up
with a grade. That grade should be returned as a double.
- The setExamGrade method should use its parameter to set the value of the examGrade property.
- The setQuizGrade method should use its parameter to set the value of the QuizGrade property.
- The setProjectGrade method should use its parameter to set the value of the ProjectGrade property
now uncomment the commented lines of code in the StudentTester
class and compile and test your code. For your reference the lines that
you need to remove the // from the beginning are:
- //Student testStudent = new Student(123);//this students id is 123
- // testStudent.setExamGrade(userValue);
- // testStudent.setProjectGrade(userValue);
- // testStudent.setQuizGrade(userValue);
- // finalGrade = testStudent.calculateGrade();
Submitting:
again zip up your project folder and submit it to me by email.
Make sure that your submitted zip file
contains your first initial and last name as part of the zip file name.