//Array Use - OOP Example

public class StudentGrade{
    
    private String name;
    private double [] examScores;
    private double [] homeworkScores;
    
    //Constructor
    public StudentGrade(int numExams, int numHomeworks, String name){
        this.name = name;
        examScores = new double[numExams]; 
        homeworkScores = new double[numHomeworks];
    }
    
    //instance method that will give access to the array examScores
    public double [] getExamScores(){
        //complete
        return examScores;
    }
    
    //Enter particular exam score
    public void updateExamScore(int index, double value){
        if(index >= 0 && index < examScores.length){
            examScores[index] = value;
        }
        else{
            System.out.println("Invalid Exam Entry");
        }
    }
    
    
    //Returns the lowest of the exam scores
    public double lowestExamScore(){
        
        //Complete
      if(examScores == null || (examScores.length == 0)){
        System.out.println("There is data to compute the score from");
        return 0.0;
      }
      
         double min = examScores[0];
         for(int i = 1; i < examScores.length; i++){
           if(examScores[i] < min){
             min = examScores[i];
           }
         }
         return min;    
    }
      
    
}//end of class
