You are viewing a single comment's thread. Return to all comments →
class Student extends Person{ private int[] testScores; Student(String firstName, String lastName, int identification, int a[]){ super(firstName,lastName,identification); this.testScores=a; } public String calculate(){ int sum=0; for(int i=0; i<testScores.length; i++){ sum+=testScores[i]; } int avg=sum/testScores.length; if(avg>=90 && avg<=100){ return "O"; } else if(avg>=80 && avg<90){ return "E"; } else if(avg>=70 && avg<80){ return "A"; } else if(avg>=55 && avg<70){ return "P"; } else if(avg>=40 && avg<55){ return "D"; } return "T"; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 12: Inheritance
You are viewing a single comment's thread. Return to all comments →