Created
January 10, 2011 03:10
-
-
Save AlfredoCasado/772297 to your computer and use it in GitHub Desktop.
Iteracion 1 con modelo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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