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,intidentification,int[]testScores):base(firstName,lastName,identification){this.testScores=testScores;}/* * Method Name: Calculate * Return: A character denoting the grade. */// Write your method herepubliccharCalculate(){doubleaverage=testScores.Average();if(average>=90)return'O';elseif(average>=80)return'E';elseif(average>=70)return'A';elseif(average>=55)return'P';elseif(average>=40)return'D';elsereturn'T';}}
Cookie support is required to access HackerRank
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 →
in C#