Comp 151 Project 3

Creating a class


You will create your first full class with attributes and methods in this project

Due: Tuesday Oct 5th at 11:59pm


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.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:

UML diagram for the Student class which must be implemented

The methods in this class must behave as follows

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:
  1. //Student testStudent = new Student(123);//this students id is 123
  2. //    testStudent.setExamGrade(userValue);
  3.     //    testStudent.setProjectGrade(userValue);
  4. //    testStudent.setQuizGrade(userValue);
  5.     //    finalGrade = testStudent.calculateGrade();


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.