Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am in a hurry please help me Consider the TechShop, Device, Laptop and Usb classes described in the following UML: TechShop -name: String -

image text in transcribedimage text in transcribedi am in a hurry please help me

Consider the TechShop, Device, Laptop and Usb classes described in the following UML: TechShop -name: String - devices: ArrayList #price: double + toString(): String + Device (all arguments) + toString(): String + //getters & Setters methods + is Alternativelo: Object): boolean Usb Laptop -cpu: String storage: int type: String + Laptop (all arguments) + Usb (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 is Alternative. 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 (coreis, 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; } @Override public String toString() { return "Usb " + super.toString() + " Storage is" + storage + } @Override public boolean isAlternative (Object of return true; } GB

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How can cohesiveness and diversity support group effectiveness?

Answered: 1 week ago

Question

How should information systems projects be selected and managed?

Answered: 1 week ago