diff --git a/documentos/preSRC/Cinema.java b/documentos/preSRC/Cinema.java new file mode 100644 index 0000000..7116dc9 --- /dev/null +++ b/documentos/preSRC/Cinema.java @@ -0,0 +1,66 @@ +package documentos.preSRC; + +class Cinema { + + public Cinema() {} + + public void showMovies() {} + public Ticket buyTicket(Moviegoer moviegoer, Movie movie) { + return + } + +} + +class Movie { + + public Movie(String title, String director, int length) {} + + public String getTitle() { + return} + public String getDirector() { + return + } + public int getLength() { + return + } +} + +class Ticket { + + public Ticket(Moviegoer moviegoer, Movie movie) {} + + public Movie getMovie() { + return + } + public Moviegoer getgetMoviegoer() { + return + } +} + +class Moviegoer { + + public Moviegoer(String name) {} + public String getName() { + return + } +} + +class Simulation { + public static void main(String[] args) { + + Cinema cinesaSantander = new Cinema(); + + Movie interstellar = new Movie("Interstellar", "Christopher Nolan", 169); + Movie lordOfTheRings = new Movie("El Señor de los Anillos", "Peter Jackson", 178); + + cinesaSantander.showMovies(); + + Moviegoer rogerWilco = new Moviegoer("Juan"); + Moviegoer guybrushThreepwood = new Moviegoer("Pedro") + + + Ticket ticket1 = cinesaSantander.buyTicket(rogerWilco, interstellar); + Ticket ticket2 = cinesaSantander.buyTicket(guybrushThreepwood, lordOfTheRings); + + } +} \ No newline at end of file diff --git a/entregas/AndecocheaMiguel/reto-001/CentroComercial.java b/entregas/AndecocheaMiguel/reto-001/CentroComercial.java new file mode 100644 index 0000000..d3f452a --- /dev/null +++ b/entregas/AndecocheaMiguel/reto-001/CentroComercial.java @@ -0,0 +1,135 @@ +import java.util.Random; + +public class CentroComercial { + public static void main(String[] args) { + int[] caja={0,0,0,0,0}; + int[] objetos={0,0,0,0,0}; + boolean[] libre={ true, true, true, true, true }; + int cola= 0; + final int minutosEnUnDia = 12 * 60; + int numeroDeClientes = 0; + boolean llegaNuevo = false; + int minutosSinCola = 0; + int totalItems = 0; + int caja5 = 0, nItems5 = 0; + boolean libre5 = true, activa = false; + + for (int tiempo=1; tiempo< minutosEnUnDia; tiempo++) { + if (Math.random() * 100 < 40) { + + llegaNuevo = true; + cola++; + if (libre[0]) { + caja[0]++; + libre[0] = false; + nItems[0] = ((int) (Math.random() * 100)) % 11 + 5; + totalItems = totalItems + nItems[0]; + cola--; + + } else if (libre[1]) { + caja[1]++; + libre[1] = false; + nItems[1] = ((int) (Math.random() * 100)) % 11 + 5; + totalItems = totalItems + nItems[1]; + cola--; + + } else if (libre[2]) { + caja[2]++; + libre[2] = false; + nItems[2] = ((int) (Math.random() * 100)) % 11 + 5; + totalItems = totalItems + nItems[2]; + cola--; + + } else if (libre[3]) { + caja[3]++; + libre[3] = false; + nItems[3] = ((int) (Math.random() * 100)) % 11 + 5; + totalItems = totalItems + nItems[3]; + cola--; + } else if (libre[4] && activa) { + caja[4]++; + libre[4] = false; + nItems[4] = ((int) (Math.random() * 100)) % 11 + 5; + totalItems = totalItems + nItems[4]; + cola--; + } + + } + + if (nItems[0] > 0) { + nItems[0]--; + if (nItems[0] == 0) { + libre[0] = true; + } + } + if (nItems[1] > 0) { + nItems[1]--; + if (nItems[1] == 0) { + libre[1] = true; + } + } + + if (nItems[2] > 0) { + nItems[2]--; + if (nItems[2] == 0) { + libre[2] = true; + } + } + + if (nItems[3] > 0) { + nItems[3]--; + if (nItems[3] == 0) { + libre[3] = true; + } + } + + if (nItems[4] > 0) { + nItems[4]--; + if (nItems[4] == 0) { + libre[4] = true; + } + } + if (cola == 0) { + minutosSinCola++; + } + + + System.out.print("MINUTO " + tiempo); + if (llegaNuevo) { + System.out.println(" - LLega 1 persona - En cola: " + cola); + llegaNuevo = false; + } else { + System.out.println(" - LLega 0 persona - En cola: " + cola); + } + System.out.print(" Caja 1:[" + nItems[0] + "] | Caja 2:[" + nItems[1] + "] | Caja 3:[" + nItems[2] + "] | Caja 4:[" + nItems[3] + "]"); + if (nItems5 > 0 || activa) { + System.out.println(" Caja 5:[" + nItems[4] + "] "); + } else { + System.out.println(); + } + + if (cola >= 15) { + activa = true; + } else { + activa = false; + } + + } + for(int i=0 ; i < caja.length; i++){ + System.out.println("Clientes totales que pasan por la caja 1"+(i+1) +": " + caja[i]); + } + + int total=0; + for(int i=0 ; i < caja.length; i++){ + total += caja[i]; + } + System.out.println("Personas que han pasado por la tienda: " + total); + System.out.println("Hoy se han vendido " + totalItems + " de productos"); + System.out.println("La cola ha estado vacia durante " + minutosSinCola + " minutos"); + System.out.println("Clientes que han quedado sin atender: " + cola); + + + } +} + + \ No newline at end of file diff --git a/entregas/AndecocheaMiguel/reto-003/Reto-003.java b/entregas/AndecocheaMiguel/reto-003/Reto-003.java new file mode 100644 index 0000000..001828b --- /dev/null +++ b/entregas/AndecocheaMiguel/reto-003/Reto-003.java @@ -0,0 +1,29 @@ +public class Restaurante{ + + public boolean abierto() + public Reserva buscarMesa(Reserva reserva) + public bolean mesaDisponible(Mesa mesa) +} + +class cliente{ + + public String nombre; + public String apellido; + public cliente (String nombre, String apellido) + +} + +class reserva{ + + public reserva(cliente cliente, String fecha, Mesa mesa) + public String fecha(); + +} + +class Mesa{ + + public int capacidad; + public int numero; + public boolean mesaLibre; + public mesa( int capacidad, int numero, boolean mesaDisponible) +} \ No newline at end of file diff --git a/entregas/AndecocheaMiguel/reto-003/Reto03-Corregido.java b/entregas/AndecocheaMiguel/reto-003/Reto03-Corregido.java new file mode 100644 index 0000000..ac31f28 --- /dev/null +++ b/entregas/AndecocheaMiguel/reto-003/Reto03-Corregido.java @@ -0,0 +1,31 @@ +public class Restaurante{ + + public boolean abierto() + public boolean mesaDisponible(Mesa mesa) + public Reserva buscarMesa() + +} + +class Cliente{ + + public Cliente (String nombre, String apellido) + public Cliente (String telefono) + public Cliente (String nombre, int telefono) + public void darNombre(String nombre, String apellido) + public voud darTelefono(int telefono) + +} + +class Reserva{ + + public Reserva(cliente cliente, int fecha, Mesa mesa) + public void darFecha(int fecha); + +} + +class Mesa{ + + public Mesa( int capacidad, int numero, boolean mesaDisponible) + public int capacidad; + public boolean mesaLibre; +} \ No newline at end of file diff --git a/images/modelosUML/plantUML/cinemaDC.svg b/images/modelosUML/plantUML/cinemaDC.svg new file mode 100644 index 0000000..c604945 --- /dev/null +++ b/images/modelosUML/plantUML/cinemaDC.svg @@ -0,0 +1,47 @@ +CinemaCinema()showMovies(): voidbuyTicket(Moviegoer, Movie): TicketMovieMovie(title: String, director: String, length: int)getTitle(): StringgetDirector(): StringgetLength(): intTicketTicket(Moviegoer, Movie)getMovie(): MoviegetMoviegoer(): MoviegoerMoviegoerMoviegoer(name: String)getName(): String \ No newline at end of file diff --git a/images/modelosUML/plantUML/cinemaDO.svg b/images/modelosUML/plantUML/cinemaDO.svg new file mode 100644 index 0000000..b1af498 --- /dev/null +++ b/images/modelosUML/plantUML/cinemaDO.svg @@ -0,0 +1,55 @@ +cinesaSantander: Cinemainterstellar: Movietitle: "Interstellar"director: "Christopher Nolan"length: 169lordOfTheRings: Movietitle: "El Señor de los Anillos"director: "Peter Jackson"length: 178rogerWilco: Moviegoername: "Juan"guybrushThreepwood: Moviegoername: "Pedro"ticket1: Ticketticket2: Ticket \ No newline at end of file diff --git a/plantUML/cinemaDC.puml b/plantUML/cinemaDC.puml new file mode 100644 index 0000000..7d9566b --- /dev/null +++ b/plantUML/cinemaDC.puml @@ -0,0 +1,30 @@ +@startuml +class Cinema { + +Cinema() + +showMovies(): void + +buyTicket(Moviegoer, Movie): Ticket +} + +class Movie { + +Movie(title: String, director: String, length: int) + +getTitle(): String + +getDirector(): String + +getLength(): int +} + +class Ticket { + +Ticket(Moviegoer, Movie) + +getMovie(): Movie + +getMoviegoer(): Moviegoer +} + +class Moviegoer { + +Moviegoer(name: String) + +getName(): String +} + +Cinema -- Ticket +Ticket -- Moviegoer +Ticket -- Movie + +@enduml diff --git a/plantUML/cinemaDO.puml b/plantUML/cinemaDO.puml new file mode 100644 index 0000000..304280c --- /dev/null +++ b/plantUML/cinemaDO.puml @@ -0,0 +1,39 @@ +@startuml +object "cinesaSantander: Cinema" as cinesaSantander { +} + +object "interstellar: Movie" as interstellar { + title: "Interstellar" + director: "Christopher Nolan" + length: 169 +} + +object "lordOfTheRings: Movie" as lordOfTheRings { + title: "El Señor de los Anillos" + director: "Peter Jackson" + length: 178 +} + +object "rogerWilco: Moviegoer" as rogerWilco { + name: "Juan" +} + +object "guybrushThreepwood: Moviegoer" as guybrushThreepwood { + name: "Pedro" +} + +object "ticket1: Ticket" as ticket1 { + +} + +object "ticket2: Ticket" as ticket2 { + +} + +cinesaSantander -d- ticket1 +cinesaSantander -d- ticket2 +interstellar -u- ticket1 +lordOfTheRings -u- ticket2 +rogerWilco -u- ticket1 +guybrushThreepwood -u- ticket2 +@enduml diff --git a/temario/aDiaDeHoy.md b/temario/aDiaDeHoy.md index b13ccfc..2218c0e 100644 --- a/temario/aDiaDeHoy.md +++ b/temario/aDiaDeHoy.md @@ -6,3 +6,8 @@ - Clase / Objeto / Mensaje / Método / Atributo / Estado - Vista pública de la clase - Cabecera de métodos + - El constructor, el destructor, la sobrecarga. + - Un constructor no construye nada. +- Vista pública de objetos + - Crear objetos + - Enviar mensajes