/** * A class to model printing or copy cards that store * credits for future pages of printing. * New cards start with no pages of printing. */ public class PrinterCard { private int pages = 0; /** * buy: increase the credits on this card by newPages */ public void buy(int newPages) { pages = pages + newPages; } /** * print: print a single page which costs 1 credit */ public void print() { pages = pages - 1; } /** * printMultiple: print a given number of pages where * each page which costs 1 credit. */ public void printMultiple(int numPages) { pages = pages - numPages; } /** * getBalance: reports the available credits remaining on the card */ public int getBalance() { return pages; } } // class PrinterCard