Question: Given the following 2 definitions for Computer and Notebook: public class Computer { private String manufacturer; private String processor; private int ramSize; private int diskSize;

Given the following 2 definitions for Computer and Notebook:

public class Computer {

private String manufacturer;

private String processor;

private int ramSize;

private int diskSize;

private double processorSpeed;

public Computer(String manuf, String proc, int ram, int disk, double prcSpeed){

manufacturer = manuf;

processor = proc;

ramSize = ram;

diskSize = disk;

processorSpeed = prcSpeed;

}

public int getRamSize(){

return ramSize;

}

public int getDiskSize(){

return diskSize;

}

public double getProcessorSpeed(){

return processorSpeed;

}

public String toString(){

return "manufacturer: " + manufacturer + " " +

" processor: " + processor + " "+

" ramSize: " + ramSize + " " +

" diskSize: " + diskSize + " " +

" processorSpeed: " + processorSpeed;

}

}

public class Notebook extends Computer {

private double screenSize;

private double weight;

public Notebook( String manuf, String proc, int ram, int disk,

double prcSpeed, double ScrnSz, double wt){

super(manuf, proc, ram, disk, prcSpeed);

screenSize = ScrnSz;

weight = wt;

}

public double getScreenSize(){

return screenSize;

}

public double getWeight(){

return weight;

}

}

And:

Computer myComputer = new Computer("Acme", "Intel", 2, 160, 2.4);

Computer workComputer = new Notebook("DellGate", "AMD", 4, 240, 1.8, 15.0, 7.5);

(1) Which line of code doesn't compile?

a) workComputer.getWeight();

b) workComputer.getRamSize();

c) workComputer.getProcessorSpeed();

d) workComputer.toString();

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!