Question: Please use Java proramming Consider the TechShop, Device, Laptop and Usb classes described in the following UML: TechShop name: String - devices: ArrayList + TechShop

 Please use Java proramming Consider the TechShop, Device, Laptop and Usb

Please use Java proramming

Consider the TechShop, Device, Laptop and Usb classes described in the following UML: TechShop name: String - devices: ArrayList + TechShop (name: String) + addDevice(d: device): void + getDevices(type: int): ArrayList + toString(: String Device #brand: String #price: double + Device (all arguments) + toString(): String + Ilgetters & Setters methods + is Alternative(o: Object): boolean Laptop Usb - cpu: String storage: int - type: String + Usb (all arguments) + Laptop (all arguments) + toString(): String + toString(): String + getCpu():String + getType():String Question 1: (15 Points) Implement the class Device. In this question, you are required to declare all the attributes and methods (the constructor, the getters/setter methods...) as presented in the UML diagram. a. The class is abstract and contains an abstract method named isAlternative. b. The method toString method returns a String of the form Brand: ... Price: ... dollars. Question 2 [15 points]: Implement the class Laptop. It has two private attributes. The cpu (corei5, corei7...) and the type that indicates whether the Laptop is ultrabook, notebook, etc. a. Implement the constructor and the getter/setter methods b. The toString method returns a String of the form: Laptop Brand: .... Price .... dollars. Cpu: ... And Type:... Question 3 Do Not Implement class Usb. The code is public class Usb extends Device { private int storage; public Usb (String brand, double price, int s) { super (brand, price); this.storage = S; + " Storage is" + storage + "GB" i @Override public String toString() { return "Usb " + super.toString() } @Override public boolean isAlternative (Object o) { return true; }

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!