Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ordenadarBurbuja(Residente [] residentesOrd, int numeroResidentes){
- Residente temp;
- for(int i = 0; i < numeroResidentes - 1; i++){
- for(int j = i; i < numeroResidentes; j++){
- if(residentes[j].getNombre().compareToIgnoreCase(residentesOrd[j].getNombre()) < 0){
- temp = residentes[i];
- residentes[i] = residentes[j];
- residentes[j] = temp;
- }
- }
- }
- }
- public String listadoResidentesHabitaciones(Date fecha){
- Residente[] auxResidentes = new Residente[getNResidentes()];
- int contador = 0;
- String listado = "";
- for(int i = 0; i < getNReservas(); i++){
- if(isHabitacionOcupada(reservas[i].getHabitacion(), fecha) == true){
- auxResidentes[contador] = reservas[i].getResidente();
- contador++;
- }
- }
- ordenadarBurbuja(auxResidentes, contador);
- for(int j = 0; j < contador; j++){
- listado = listado + auxResidentes[j].getNombre();
- }
- return listado;
Add Comment
Please, Sign In to add comment