AleksandarKostadinov

04. Average Grades

Feb 8th, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. namespace _04.AverageGrades
  2. {
  3.     using System.Collections.Generic;
  4.     using System.Linq;
  5.  
  6.     class Student
  7.     {
  8.         public string Name { get; set; }
  9.  
  10.         public List<double> Grades { get; set; }
  11.  
  12.         public Student(string name, List<double> grades)
  13.         {
  14.             Name = name;
  15.             Grades = grades;
  16.         }
  17.  
  18.         public double AverageGrade()
  19.         {
  20.             return this.Grades.Average();
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment