Question: Part I: Store # name: String example: James Electronics # address: String lexample: Beirut/Hamra # devices: ArrayList + Store (name: String, address: String) + addDevice(d:

 Part I: Store # name: String example: James Electronics # address:

Part I: Store # name: String example: James Electronics # address: String lexample: Beirut/Hamra # devices: ArrayList + Store (name: String, address: String) + addDevice(d: device): void + getDevices(): ArrayList +toString(): String Device # name: String #price: doube #voltage: double #amp: double + Device (all arguments) + toString(): String + getters & Setters + power(): double AC - frequency: int + AC (all arguments) + toString(): String DC -battery Arrangement: int 10 for serial, 1 for parallel - batteryCount: int + DC (all arguments) + toString(): String Question 1 Implement the class Device. In this question, you are required to declare all the attributes and define the methods (constructor, the getters/setter, ..) as presented in the UML diagram. a. The class is abstract and contains an abstract method named power. b. The method toString should be defined to return a device's info as follows: Name: --- Price $: -- Voltage: --- Amp: Question 2 Define the class DC. In this question, you are required to declare the attributes and define the constructor and the getters/setter methods as presented in the UML diagram. battery Arrangment can be o representing 'serial' arrangement or 1 representing parallel' arrangement. - toString method returns information as follows: Name: ... Price $: Voltage: Amp: The device has number of batteries=-- and they are arranged in .- (serial or parallel).. Power consumption is Question 3: Do NOT implement the class AC, the code is: public class AC extends Device { private int freq; public AC (String name, double price, double voltage, double amp, int freq) super (name, price, voltage, amp); this. freq - freq; } public int get Frequency () { return freq; } { public void set Frequency (int frequency) { this. freq - freq; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!