Question: Exercise 1. (60 pts) Implement the class Tablet as presented by the following UML diagram: Laptop - brandName: String // ex: Dell /Hp/ ... Lenovo


Exercise 1. (60 pts) Implement the class Tablet as presented by the following UML diagram: Laptop - brandName: String // ex: Dell /Hp/ ... Lenovo - Ram: int - screen Size: double - touchScreen: Boolean +Laptop(---All Attributes--) (10 pts) // parameterized constructor +getters/setters (20 pts) -penSetting0: String (10 pts) +toStringO: String(20 pts) penSetting(): returns With Pen if touchScreen is true and No Pen otherwise. toString(): returns one string with a full description of the laptop. For example, for a Laptop with the following values for the instance fields brandName = Lenevo Thinkpad, Ram = 8, screen Size = 15.6, and touchScreen=true, the toString method should return the following string: Lenovo Think Pad 15.6 inches 8GB RAM Touch Screen With Pen Note that you need to call penSetting to get the With Pen part. Exercise 2. (40 pts) Write a driver class to test the Laptop class as follows: a. Create a Laptop object laptop by reading the brandName, Ram, screenSize and penSetting from the user. (30 pts) Read the brandName as String Read the Ram as an int Read the screen Size as a double Read touchScreen as a "true" or "false" b. Print the description of laptop. (10 pts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
