-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEstudiante.cpp
60 lines (46 loc) · 1.17 KB
/
Estudiante.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
#include <cstring>
#include <iostream>
#include "Estudiante.h"
std::string Estudiante::getApellidos(){
std::string apellidos;
apellidos = _apellidos;
return apellidos;
}
std::string Estudiante::getNombres(){
std::string nombres(_nombres);
return nombres;
}
std::string Estudiante::toString(){
std::string cadena;
cadena = std::to_string(_legajo) + "," + _apellidos + "," + _nombres + "," + _fnac.toString();
return cadena;
}
int Estudiante::getLegajo(){
return _legajo;
}
Fecha Estudiante::getFechaNacimiento(){
return _fnac;
}
int Estudiante::getEdad(){
Fecha actual;
int edad = actual.getAnio() - _fnac.getAnio();
if (actual.getMes() > _fnac.getMes()){
return edad;
}
if (actual.getMes() == _fnac.getMes() && actual.getDia() >= _fnac.getDia()){
return edad;
}
return edad -1;
}
void Estudiante::setApellidos(std::string apellidos){
strcpy(_apellidos, apellidos.c_str());
}
void Estudiante::setNombres(std::string nombres){
strcpy(_nombres, nombres.c_str());
}
void Estudiante::setLegajo(int legajo){
_legajo = legajo;
}
void Estudiante::setFechaNacimiento(Fecha fnac){
_fnac = fnac;
}