110,535
社区成员
发帖
与我相关
我的任务
分享
///Person
calss Person
{
public strig Name{get;set;}
public byte Age{get;set;}
public byte Sex{get;set;}
}
///Student
class Student:Person
{
/// Scores list
public List<float> Scores{get;set}
/// Get Avg Score
public float GetAvgScore()
{
if(Scores==null|| Scores.Count==0){return 0F;}
float avgScore=0F;
foreach(float score in Scores)
{
avgScoe+=score;
}
avgScore=avgScore/(float)Scores.Count;
return avgScore;
}
}