Starting from:

$15

COP2800 Assignment 5 Solution

When Elvis gets up in the morning, he likes to have a little fun with his donuts. He loves crème filled, strawberry filled, grape filled, apple filled, cinnamon filled, blueberry filled and banana filled donuts.

By the time Elvis sits down to breakfast, the Lazy Susan is loaded up with five donuts chosen at random by his housekeeper. Elvis spins the Lazy Susan three times, eats what’s closest to him, and goes about his business for the day.

Design Requirements:

1. Three classes… Elvis, LazySusan and Donut. Each class has a defined toString() method.

2. A Donut has a Filling. Filling should be an enumerated type. Tools you may need:
The length of an enum : Filling.values().length.
Conversion of an int to a enum value : Filling.values()[3].

3. Donuts should be held in arrays inside Elvis and LazySusan.

4. When Elvis eats a donut it must, of course, come off the LazySusan.

5. Your driver should load up the Lazy Susan, display its contents, spin it three times, display Elvis’ tummy, and what’s left on the Lazy Susan.

Sample output on next page. But, it’s not sufficient to generate output similar to mine; this is an exercise is class design, aggregation, and arrays.

Submissions that don’t compile will get a grade of 0.

Please name your public class file Assignment5.java, capitalized like that and with no spaces. It will facilitate grading.


Sample runs:

More products