questionconsider a class boulesurprise that


Question

Consider a class BouleSurprise that models a machine dispensing surprise gifts in balls. It contains an instance variable which specifies actual number of balls left in the machine. The Constructor returns a reference to newly created BouleSurprise object and initialises instance variable. The getBall way returns the number of balls left. The dispenseBall means dispenses one ball at a time, adjusts instance variable and returns true as there are balls remaining. If there are no remaining balls, dispenseBall method returns false.

(a) Identify the class BouleSurprise.

(b) Execute the Constructor of this class in Java.

(c) Execute the getBalls method in Java.

(d) Execute the dispenseBall method in Java

(e) What is a test driver and how is it helpful?

(f) Write down a static test driver for the BouleSurprise class.

(g) Write down a small program which calls the test driver.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questionconsider a class boulesurprise that
Reference No:- TGS0444227

Expected delivery within 24 Hours