2
I need to create a public method called mostraData
where a date is passed as a parameter (a parameter, not a separate day, month and year) and the date is returned in the following format: dd / mm /aaaa
.
Keep in mind that if the values have fewer digits, you must fill in with zeros on the left to comply with the standard format. I already created the builder as I was asked in the exercise (one by default and another by parameter) with the requested attributes as well. Thank you.
package fechaapp;
public class Fecha {
private int dia;
private int mes;
private int anyo;
public Fecha(){
this.setDia(1);
this.setMes(1);
this.setAnyo(2000);
}
public Fecha(int dia, int mes, int anyo){
this.setDia(dia);
this.setMes(mes);
this.setAnyo(anyo);
}
public int getDia() {
return dia;
}
public void setDia(int dia) {
this.dia = dia;
}
public int getMes() {
return mes;
}
public void setMes(int mes) {
this.mes = mes;
}
public int getAnyo() {
return anyo;
}
public void setAnyo(int anyo) {
this.anyo = anyo;
}
public void mostraData(int fecha){
}
public void calculaSemanaMes(){}
public void calculaSemanaAnyo(){}
public void esAnyoExtraordinario() {}
public void calculaDiaSemana(){}
public void esFestivo(){}
public void esLaborable(){}
public void fechaFormat(){}
}
what is the pattern of the date you received? ddmmaaaa?
– Michel Simões
Yeah, that’s right, I’m sorry.
– Marcio.Rezende