QUESTION

Part I)

In Java please
An appliance object has four attributes, a type (String), a brand (String), a serial number (long), and a price (double). The type of an appliance can be any of the following: Fridge, Air Conditioner, Washer, Dryer, Freezer, Stove, Dishwasher, Water Heaters, and Microwave. The brand indicates the vendor/manufacturer of the appliance (such as LG, Samsung, Bosch, etc.), and can be any string. The serial number represents the serial number of the appliance, and must be unique. For simplicity, we assume that the serial numbers start at 1000000 and it is common/shared among all different brands and types (for example, if the creation of objects starts by a Washer created by Maytag, then it will be assigned serial number 1000000. If a Microwave by Breville is created next, then it will be assigned serial number 1000001, and so on afterwards). The price of an appliance cannot be less than 1$. (Hint: Static – You are allowed to add other attributes to the class.)
For this part, you are required to design and implement the Appliance class according to the following specifications:
COMP249/Fall 2020 - Assignment 1 Page 2 of 5
What do you want to do?
1.Enter new appliances (password required)
2.Change information of an appliance (password required)
3.Display all appliances by a specific brand
4.Display all appliances under a certain a price.
5.Quit
Please enter your choice >
-Upon the creation of an appliance object, the object must immediately be initialized withvalid values; that is type, brand, serial number and price. (Hint: Constructors.)
-The design should allow enough flexibility so that the value of any of these attributes canbe modified later on (with the exception of the serial number, which can never bechanged once assigned). For example, it should be possible to create an appliance objectwith a given price then change its price later on. Notice that changes to brand or type isallowed (although this is unusual in reality!). The design should also allow the user toobtain the value of any of the attributes. (Hint: Accessors & Mutators.)
-The design should allow all information of an object to be displayed at once through theutilization of System.out.print() method. (Hint: toString() method)
-It is required to know how many appliance objects have been created. For that, you needto add a method, called findNumberOfCreatedAppliances(), to the class. This methodmust return the number of created appliance objects prior to the time this method iscalled. The method would simply return 0 if no appliances have been created by the timethe method is called.
-It is required to compare two Appliance objects for equality. Two appliances areconsidered equal if they have the same brand, type and price. (Hint: equals() method)
-It is required to display any Appliance object (all info of that object) usingSystem.out.println() method. (Hint: toSting() method)

Public Answer

LKA72O The First Answerer