Design the cake class. The cake class has 2 instance variables, a double called radius and a bool called isEaten. Write
Posted: Thu May 05, 2022 1:02 pm
Design the cake class. The cake class has 2 instance variables,
a double
called radius and a bool called isEaten. Write the following
methods for the
cake class:
a. A default constructor that sets radius to 1.5 and bool to
false.
b. An instance method named EatCake. The cake calling the method
has
its radius set to 0 and isEaten value set to true.
c. A static method named EatBakery. It accepts an array of cake
objects
as a parameter. The method passes all cakes in the array to
the EatCake method.
a double
called radius and a bool called isEaten. Write the following
methods for the
cake class:
a. A default constructor that sets radius to 1.5 and bool to
false.
b. An instance method named EatCake. The cake calling the method
has
its radius set to 0 and isEaten value set to true.
c. A static method named EatBakery. It accepts an array of cake
objects
as a parameter. The method passes all cakes in the array to
the EatCake method.