Created
January 1, 2017 22:43
-
-
Save dzsquared/05d44d4e0b164f7fc022ee167d75d443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Student : Person{ | |
| private int[] testScores; | |
| public Student(string firstName, string lastName, int identification, int[] scores) { | |
| this.firstName = firstName; | |
| this.lastName = lastName; | |
| this.id = identification; | |
| this.testScores = scores; | |
| } | |
| public string calculate() { | |
| double totalScore = 0; | |
| string returnLetter; | |
| for(int j = 0; j < testScores.Length; j++) { | |
| totalScore += testScores[j]; | |
| } | |
| if(totalScore/(testScores.Length) >= 90) { | |
| returnLetter = "O"; | |
| } else if(totalScore/(testScores.Length) < 90 && totalScore/(testScores.Length) >= 80) { | |
| returnLetter = "E"; | |
| } else if(totalScore/(testScores.Length) < 80 && totalScore/(testScores.Length) >= 70) { | |
| returnLetter = "A"; | |
| } else if(totalScore/(testScores.Length) < 70 && totalScore/(testScores.Length) >= 55) { | |
| returnLetter = "P"; | |
| } else if(totalScore/(testScores.Length) < 55 && totalScore/(testScores.Length) >= 40) { | |
| returnLetter = "D"; | |
| } else { | |
| returnLetter = "T"; | |
| } | |
| return returnLetter; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment