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

You have three (3) deliverables for this project, due by 13 March:

1. Student.java (correctly formatted) (80%)
2. Student.class (10%)
3. A screen capture or copy of the output of running gradeBookDriver with your Student class. (10%)

Recommended Answers

All 2 Replies

Please put you code in the code tags, this will make the code easier to read.
Have you tried writing any of the code for Student.java?
I'm not going to do your homework for you, but I will give you a simple example:

public class MyMain
{
  public static void main(String[] args)
  {
    MyClass m = new MyClass();
    m.setName("Java Example");
    m.whatIsTheNameOfMyClass();
  }
}

public class MyClass
{
  private String name;
  public MyClass()//This is called a constructor
  {
    name = "";
  }

  public setName(String parameterString)//This is a method
  {
    name = parameterString;
  }
  
  public whatIsTheNameOfMyClass()
  {
    System.out.println(name);
  }
}

For the above example, put the 2 classes in separate files, save the files the same name as the class, compile both of them, and run the one with the main method(i.e. MyMain). This example is very simple, it is essentially the HelloWorld example for Classes.
Your .class file will be created when you successfully compile your .java file, and you screen shot just google it.
I hope this will get you started.

It would help if you actually asked a question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.