CONVERTIR ESTE CÓDIGO DE C++ A JAVA (porfis)
Publicado por Maria (1 intervención) el 01/05/2017 03:00:00
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
using namespace std;
class Curso {
// Sector privado
private:
string nombre;
string codigo;
Profesor *profesor;
int cupos;
// Sector publico
public:
Alumno *nomina[3];
// Constructor
Curso(string nombre, string codigo, Profesor *profe) {
this->nombre = nombre;
this->codigo = codigo;
this->profesor = profe;
this->nomina[0] = NULL;
this->nomina[1] = NULL;
this->nomina[2] = NULL;
}
// Getters
string getNombre() {
return this->nombre;
}
string getCodigo() {
return this->codigo;
}
string getNombreProfesor() {
return this->profesor->getNombre();
}
string getTituloProfesor() {
return this->profesor->getTitulo();
}
// Operaciones
void inscribirAlumno(Alumno *nuevo) {
if(!this->nomina[0]) {
this->nomina[0] = nuevo;
}
else if(!this->nomina[1]) {
this->nomina[1] = nuevo;
}
else if(!this->nomina[2]) {
this->nomina[2] = nuevo;
}
else {
cout << "No quedan cupos." << endl;
}
}
};
Valora esta pregunta


0