1. When should methods of a class use the access modifier private? 2. The class CupDispenser has a private data field, numberOfCups, which tracks the number of cups currently in the dispenser. Define...


1. When should methods of a class use the access modifier private?


2. The class CupDispenser has a private data field, numberOfCups, which tracks the number of cups currently in the dispenser. Define the method isEmpty for this class. The method should return true if a CupDispenser object contains no cups, or false otherwise.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here