SHARE
TWEET

Student class for student grade book

jonathanwangg Aug 12th, 2016 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. public class Student{
  3.     private String name;
  4.     private double average;
  5.     private double testScore1; // worth 25% (should I make testScore1 it's own class since a test can have a test score, test worth %)
  6.     private double testScore2; // worth 25%
  7.     private double finalExamScore; // worth 50%
  8.    
  9.     // Getter for name
  10.     public String getName() {
  11.         return name;
  12.     }
  13.    
  14.     // Setter for name
  15.     public void setName(String name) {
  16.         this.name = name;
  17.     }
  18.    
  19.     // ----------------------------------------------------
  20.     // Getter for testScore1
  21.     public double getTestScore1() {
  22.         return testScore1;
  23.     }
  24.    
  25.     // Setter for testScore1
  26.     public void setTestScore1(double testScore1) {
  27.         this.testScore1 = testScore1;
  28.     }
  29.    
  30.     // ----------------------------------------------------
  31.     // Getter for testScore2
  32.     public double getTestScore2() {
  33.         return testScore2;
  34.     }
  35.    
  36.     // Setter for testScore2
  37.     public void setTestScore2(double testScore2) {
  38.         this.testScore2 = testScore2;
  39.     }
  40.    
  41.     // ----------------------------------------------------
  42.     // Getter for finalExamScore
  43.     public double getFinalExamScore() {
  44.         return finalExamScore;
  45.     }
  46.    
  47.     // Setter for finalExamScore
  48.     public void setFinalExamScore(double finalExamScore) {
  49.         this.finalExamScore = finalExamScore;
  50.     }  
  51.    
  52.     // ----------------------------------------------------
  53.     // Getter for average
  54.     public double getAverage() {
  55.         return average;
  56.     }  
  57.    
  58.     // I think this is essentially a setter for average
  59.     public double calculateEntireAverage() {
  60.         average = (testScore1*0.25 + testScore2*0.25 + finalExamScore*0.5);
  61.         // am I just supposed to use a getter / setter for the average instead of making a method like this?
  62.         return average;
  63.     }  
  64. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top