We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
classStudent:Person{privateint[]testScores;/* * Class Constructor * * Parameters: * firstName - A string denoting the Person's first name. * lastName - A string denoting the Person's last name. * id - An integer denoting the Person's ID number. * scores - An array of integers denoting the Person's test scores. */// Write your constructor herepublicStudent(stringfirstName,stringlastName,intid,int[]scores):base(firstName,lastName,id){this.testScores=scores;}/* * Method Name: Calculate * Return: A character denoting the grade. */// Write your method herepubliccharCalculate(){intsum=0;for(inti=0;i<testScores.Count();i++){sum+=testScores[i];}doubletb=sum/testScores.Count();if(tb>=90&&tb<=100){return'O';}elseif(tb>=80&&tb<90){return'E';}elseif(tb>=70&&tb<80){return'A';}elseif(tb>=55&&tb<70){return'P';}elseif(tb>=40&&tb<55){return'D';}else{return'T';}}}
Day 12: Inheritance
You are viewing a single comment's thread. Return to all comments →
C# Solution