Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this question assume the following implementations of Computer, Tablet, and Notebook 1 public class Computer { private String manufacturer; private String processor; 4 private
For this question assume the following implementations of Computer, Tablet, and Notebook 1 public class Computer { private String manufacturer; private String processor; 4 private int ramSize; private int diskSize; private double processorSpeed; 7 8 public Computer (String man, String pro, int rasize, int diSize, double prospe 9 manufacturer = man; 10 processor pro; 11 ramSize = raSize; 12 diskSize = diSize; 13 processor Speed = proSpeed; 14 } 15 16 17 public String getManufacturer() { 18 return manufacturer; 19 } 20 21 public int getRamSize() { 23 return ramSize; 24 } 25 26 27 public int getDiskSize() { 28 return diskSize; 29 } 30 31 32 public double getProcessor Speed() { 33 return processorspeed; 34 } 35 36 37 public String getModel() { 22 = 38 return this.getManufacturer() + this.getProcessorSpeed(); 39 } 40 41 42 43 ublic class Tablet extends Computer 44 private int length; 45 private int width; 46 private String operatingSystem; 47 48 public Tablet(String man, String pro, int raSize, int disize, double proSpeed 49 super (man, pro, rasize, disize, prospeed); 50 length = len; 51 width = wid; 52 operatingSystem = os; 53 } 54 55 public int getArea() { 56 return length * width; 57 } } 58 59 @Override 60 public String toString() { 61 return "My Tablet was made by: + getManufacturer() 62 + ", and has a screen area of: a + getArea(); 63 } 64 65 66 67 ublic class Notebook extends Computer{ 68 public Notebook (String man, String pro, int rasize, int disize, double prospel 69 super (man, pro, rasize, disize, proSpeed); 70 } 71) For this exercise, you will be writing a new method for the Tablet class. Write a method that overrides Computer getModel, that adds the length and width to the string returned. ---- 61 return "My Tablet was made by: + getManufacturer() + ", and has a screen area of: + getArea(); II 62 w N 63 } 64 65 66 67 ublic class Notebook extends Computer{ 68 public Notebook (String man, String pro, int raSize, int diSize, double proSped 69 super(man, pro, raSize, diSize, proSpeed); 70 } 71 O 000 For this exercise, you will be writing a new method for the Tablet class. Write a method that overrides Computer getModel, that adds the length and width to the string returned. For example: = If I had a Computer object where manufacturer = "MAN" and processor Speed = 5.5, then running getModel would return the string "MAN_5.5" If I had a Tablet where Manufacturer was MAN, processor Speed was 5.5, length was 11, and width was 8.5, then running getModel would return "MAN 5.5 8.5 11
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started