You are viewing a single comment's thread. Return to all comments →
String calculate(){ int sum=0; for(int a:testScores){ sum+=a; } int avg=sum/testScores.length; if(avg>40){ if(avg<55) return "D"; if(avg<70) return "P"; if(avg<80) return "A"; if(avg<90) return "E"; else return "O"; } else{ 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 →
String calculate(){ int sum=0; for(int a:testScores){ sum+=a; } int avg=sum/testScores.length; if(avg>40){ if(avg<55) return "D"; if(avg<70) return "P"; if(avg<80) return "A"; if(avg<90) return "E"; else return "O"; } else{ return "T"; } }