/*
 * Grade - a blueprint class for representing a single grade --
 * both its raw score and the associated late penalty (if any).
 */

public class Grade {
    private double rawScore;
    private int latePenalty;
    
    /* constructor */
    public Grade(double raw, int late) {
        this.setRawScore(raw);
        this.setLatePenalty(late);
    }
    
    /* 
     * alternate constructor that takes just a raw score
     * and assumes that the late penalty is 0.
     */
    public Grade(double raw) {
        this(raw, 0);
    }
 
    /*** accessor methods for the fields ***/
    
    public double getRawScore() {
        return this.rawScore;
    }
    
    public int getLatePenalty() {
        return this.latePenalty;
    }
    
    /*** mutator methods for the fields ***/
    
    public void setRawScore(double newScore) {
        if (newScore < 0.0) {
            throw new IllegalArgumentException();
        }
        
        this.rawScore = newScore;
    }
    
    public void setLatePenalty(int newPenalty) {
        if (newPenalty < 0) {
            throw new IllegalArgumentException();
        }
        
        this.latePenalty = newPenalty;
    }
    
    /*
     * getAdjustedScore - accessor method that returns
     * the score that results from applying the late penalty.
     */
    public double getAdjustedScore() {
        double adjustedScore = this.rawScore * (100.0 - this.latePenalty)/100;
        return adjustedScore;
    }
}