-
Notifications
You must be signed in to change notification settings - Fork 4
/
发奖学金.txt
106 lines (105 loc) · 1.46 KB
/
发奖学金.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
public class student
{
protected string name;
protected int age;
protected decimal score;
public student(string name,int age,decimal score)
{
this.name=name;
this.age=age;
this.score=score;
}
public virtual string Name
{
get
{
return name;
}
set
{
name=value;
}
}
public virtual int Age
{
get
{
return age;
}
set
{
age=value;
}
}
public virtual decimal Socore
{
get
{
return score;
}
set
{
score=value;
}
}
}
public class good_student:student
{
public decimal bursary=0.0m;
public good_student(string g_name,int g_age,decimal g_score,decimal g_bursary):base(g_name,g_age,g_score)
{
this.bursary =bursary;
}
public override string Name
{
get
{
return name;
}
set
{
name = value;
}
}
public override int Age
{
get
{
return age;
}
set
{
age = value;
}
}
public override decimal Socore
{
get
{
if(score>80.0m)
{
bursary+=1200.0m;
}
else
{
bursary=0.0m;
}
return score;
}
set
{
score = value;
}
}
}
public class MainClass
{
public static void Main()
{
student s=new student ("´óÃ÷",23,32.0m);
Console.WriteLine ("\t{0},\t{1},\t{2}",s.Name ,s.Age ,s.Socore );
good_student gs=new good_student ("СÃ÷",32,89.0m,0);
Console.WriteLine ("\t{0},\t{1},\t{2},\t{3}",gs.Name,gs.Age ,gs.Socore,gs.bursary );
}
}