-
-
Save jasongorman/37e707ac8afc10e52caac60d612b1410 to your computer and use it in GitHub Desktop.
This file contains 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 CD { | |
private int stock; | |
private final double price; | |
public CD(int stock, double price) { | |
this.stock = stock; | |
this.price = price; | |
} | |
public int getStock() { | |
return stock; | |
} | |
public void buy(int quantity, CreditCard card) { | |
card.charge(price * quantity); | |
stock = stock - quantity; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment