Question: Candy Class along with its attributes and fields has to be created in ARGO UML and then then generate a Java code using UML diagaram




Create a Candy class with the following attributes: type : String Example: chocolate, sticky, gum, vanilla name : String Example: "chocolate covered pretzels, airheads, gummy worms pricePerPound : double LOW_PRICE_ITEM : double (this is a constant set to 1.25, representing $1.25 per pound and is a low price item if it is less than or equal to this amount) HIGH_PURCHASE_ITEM : double ((this is a constant set to 2.5#, representing a candy is a high purchase item if it is purchased at more than 2.5 # per purchase) and the following methods: two constructors o the default constructor o an overloaded constructor with the first 3 attributes passed in and assigned. getters and setters for the first 3 attributes a getter for the LOW_PRICE_ITEM This function will return true if the candy object is a low price item. a getter for the HIGH_PURCHASE_ITEM This function will return true if the candy object is a high purchase item. getTotalPurchase() : double - a method to return the total amount of candy purchases, formatting is important toString() to display the state of the object, What is the name, type and is this a low priced item or high purchased item. Create a CandyDriver in the main() method you will create Candy objects from the data file below, use the overloaded constructor o candy.txt from the main() method you will call a method that will display all of the information for the candys(the formatting of the output of each candy should come from within the toString()) You should check to see if the candy is low priced or a high purchase item.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
