Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entrega reto003 #91

Open
wants to merge 10 commits into
base: entrega-003
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions documentos/preSRC/Cinema.java
Original file line number Diff line number Diff line change
@@ -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);

}
}
135 changes: 135 additions & 0 deletions entregas/AndecocheaMiguel/reto-001/CentroComercial.java
Original file line number Diff line number Diff line change
@@ -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);


}
}


29 changes: 29 additions & 0 deletions entregas/AndecocheaMiguel/reto-003/Reto-003.java
Original file line number Diff line number Diff line change
@@ -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)
}
31 changes: 31 additions & 0 deletions entregas/AndecocheaMiguel/reto-003/Reto03-Corregido.java
Original file line number Diff line number Diff line change
@@ -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;
}
47 changes: 47 additions & 0 deletions images/modelosUML/plantUML/cinemaDC.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading