-
Notifications
You must be signed in to change notification settings - Fork 1
/
Student.cpp
66 lines (52 loc) · 957 Bytes
/
Student.cpp
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
#include "Student.h"
using namespace std;
//Construct ****************
Student::Student(){
name=" ";
year=0;
grades=new double[5];
}
Student::Student(string n){
name=n;
year=0;
grades=new double[5];
}
//Setters****************
void Student::setName(string n){
name=n;
}
void Student::setYear(int y){
year=y;
}
void Student::setNotas(){
for(int i=0;i<5;i++){
cout<<"Entre la nota "<<i+1<<" :";
cin>>notas[i];
}
}
void Student::setGrades(){
for(int i=0;i<5;i++){
cout<<"Entre la nota "<<i+1<<" :";
cin>>grades[i];
}
}
//Getters***************
string Student::getName(){
return name;
}
int Student::getYear(){
return year;
}
const double* Student::getNotas(){
return notas;
}
const double* Student::getGrades(){
return grades;
}
double Student::getAve(){
double sum=0;
for (int i=0;i<5;i++){
sum +=grades[i];
}
return sum/5;
}