Question: Java Object Problem Coke maker In this problem, we are going to create a class represent the concept of Coke. Coke can be Detected or


Java Object Problem Coke maker In this problem, we are going to create a class represent the concept of Coke. Coke can be Detected or undetected. We have Coke types of flavors, blend name and brand name. the diagram below describes the Coke class Coke Class isDetected: Boolean flavor: Flavor blend Name: String brandName: String -- + Coke (String, String, Flavor, boolean) + Coke (String, String, Flavor) + Coke (String, String) + isDetected 0:boolean + getFlavor (): Flavor + getBlendName 0: String + getBrand Name (): String + examine 0:boolean + toString 0: String Coke class defines an Enumeration: Flavor. There are four different types of Coke: Original Coke; Diet Coke; Coke Zero; Cherry Coke. We need to define the flavor enumeration inside the Coke class Enumeration Flavor ORIGINAL DIET ZERO CHERRY Constructors' description and methods Coke (String, String, Flavor, boolean): Create a Coke object with Blend names, Brand name and types of flavors. Also set the Coke is detected or not. Set the boolean true to Detected, false to Undetected Coke (String, String, Flavor): Create a new Coke object with Blend names, Brand name and types of flavors. The Coke is initialized as Undetected i.e., not Detected Coke (String, String): Create a new Coke object with Blend names, Brand name. Flavor type is set to Original. The Coke is initialized as Undetected i.e., not Detected isDetected (: returns a boolean informing if the Coke is detected or not 1 Getters: returns their respective properties 1 examine 0: examine the Coke object from Undetected to the Detected. Returns true if the Coke switched from the Undetected to the Detected. Returns false if the Coke was already Detected. toString 0:returns a String representing the Coke object according to the example below: Brand: Happy Coke Blend: Happy 7911 Flavor type: Zero Undetected Only unit test and no input or output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
