Skip to content

Instantly share code, notes, and snippets.

@AlfredoCasado
Created January 10, 2011 03:10
Show Gist options
  • Save AlfredoCasado/772297 to your computer and use it in GitHub Desktop.
Save AlfredoCasado/772297 to your computer and use it in GitHub Desktop.
Iteracion 1 con modelo
public class Producto {
private int precio;
public int precio() {
return precio;
}
}
public class Compra {
private List<Producto> productosComprados = new ArrayList();
public int precio() {
int total = 0;
for (Producto unProductoComprado : productosComprados) {
total+=unProductoComprado.precio();
}
return total;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment