C
The first thing to do is create a class Fechawhich you already have, however all attributes are String type and that will be a problemprotected String año,mes,dia,hora,min,seg;
public Fecha(String año,String mes,String dia,String hora,String min,String seg)
{
this.año=año;
this.mes=mes;
this.dia=dia;
this.hora=hora;
this.min=año;
this.seg=seg;
}
Now I'll make some changespublic class Fecha{
/*Declaramos todos los atributos privados y de tipo int, de esta forma si tiene que hacer validaciones (ej: si la fecha es valida. Con String pueden ingresar caracteres) */
private int año;
private int mes;
private int dia;
private int hora;
private int minuto;
private int segundos;
public Fecha(int año, int mes, int dia, int hora, int minuto, int segundos){
this.año = año;
this.mes = mes;
this.dia = dia;
/*... los demas */
}
}
Now we will see how the Student Class should remain with respect to the Date classpublic class Estudiante extends Persona{
//Declare los atributos uno por uno
private String carrera;
private String semestre;
//Declaramos un atributo de tipo Fecha
private Fecha fechaInicio; //En java es más usado el stadar camelCase
private Fecha fechaFinal;
//Como Materia es un tipo de dato y son varias materias en eun semestre, creamos una lista de objetos Materia
private List<Materia> materiasSemestre;
//Creamos el constructor
public Estudiante(String nombre, String Apellido, String cedula, String edad,
Fecha fechaNacimiento, String telefono, String direccion,
String carrera, String semestre, Fecha fechaInicio,
Fecha fechaFinal, List<Materia> materiasSemestre){
super(nombre,apellido,cedula,edad,fechaNacimiento,telefono,direccion);
this.carrera = carrera;
this.semestre = semestre;
this.fechaInicio = fechaInicio;
this.fechaFinal = fechaFinal;
this.materiasSemestre = materiasSemestre;
}
... mas métodos
}