Advertisement
FacundoCruz

clase Panaderia

May 19th, 2022
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.Random;
  4.  
  5. public class Panaderia {
  6.    
  7.     public static void main(String[] args) {
  8.        
  9.         List<Integer> bizcochos = new ArrayList<Integer>();
  10.         List<Integer> facturas = new ArrayList<Integer>();
  11.         int i=1;
  12.        
  13.         ProduccionDePanes b = new ProduccionDePanes("Bizcocho", 600, 400, bizcochos);
  14.         ProduccionDePanes f = new ProduccionDePanes("Factura", 1300, 1000, facturas);
  15.         b.start();
  16.         f.start();
  17.        
  18.         while (true) {
  19.             try {
  20.                 Random r = new Random();
  21.                 Cliente c = new Cliente(facturas, bizcochos, i);
  22.                 c.start();
  23.                 Thread.sleep(r.nextInt(1500-800)+800);
  24.             } catch (InterruptedException e) {
  25.                 e.printStackTrace();
  26.             }
  27.             i++;
  28.         }
  29.        
  30.     }
  31.  
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement