-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pedido.java
60 lines (48 loc) · 1.37 KB
/
Pedido.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package carritodecompras;
import java.util.ArrayList;
import java.util.Date;
/**
*
* @author Manny
*/
public class Pedido {
private static int Gen=256010;
private int ID;
private ArrayList <Item> articulos;
private Date fecha;
private Cliente cliente;
public Pedido(Carrito Carro) {
ID=Gen++;
cliente=Carro.getCliente();
cliente.agregarPedido(this);
articulos=Carro.getArticulos();
fecha=new Date();
}
public int getID() {
return ID;
}
public Producto getProducto(int i){
return articulos.get(i).get_prod();
}
public ArrayList<Item> getArticulos() {
return articulos;
}
public Date getFecha() {
return fecha;
}
public Cliente getCliente() {
return cliente;
}
@Override
public String toString() {
String pedido= "ID: " + ID + " , Hecho: "+fecha+"\n";
for (int i=0;i<articulos.size();i++)
pedido+=articulos.get(i).get_prod() +" , Cant: "+articulos.get(i).get_can()+"\n";
return pedido;
}
}