0
/ 50
For this question assume the following implementations of Computer, Tablet, and Notebook
public class Computer { private String...
For this question assume the following implementations of Computer, Tablet, and Notebook
public class Computer {
private String manufacturer;
private String processor;
private int ramSize;
private int diskSize;
private double processorSpeed;
public Computer(String man, String pro, int raSize, int diSize, double proSpeed) {
manufacturer = man;
processor = pro;
ramSize = raSize;
diskSize = diSize;
processorSpeed = proSpeed;
}
public String getManufacturer() {
return manufacturer;
}
public int getRamSize() {
return ramSize;
}
public int getDiskSize() {
return diskSize;
}
public double getProcessorSpeed() {
return processorSpeed;
}
public String getModel() {
return comp.getManufacturer() + comp.getProcessorSpeed();
}
}
public class Tablet extends Computer{
private int length;
private int width;
private String operatingSystem;
public Tablet(String man, String pro, int raSize, int diSize, double proSpeed, int len, int wid, String os) {
super(man, pro, raSize, diSize, proSpeed);
length = len;
width = wid;
operatingSystem = os;
}
public int getArea() {
return length * width;
}
@Override
public String toString() {
return "My Tablet was made by: " + getManufacturer()
+ ", and has a screen area of: " + getArea();
}
}
public class Notebook extends Computer{
public Notebook(String man, String pro, int raSize, int diSize, double proSpeed) {
super(man, pro, raSize, diSize, proSpeed);
}
}
For this exercise, you will be writing a new method for the Tablet class. Write a method that overrides Computer getModel, that adds in an the length and width to the string returned.
For example:
Your feedback will appear here when you check your answer.