1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marshall27 [118]
3 years ago
11

Design 3 classes: Computer - Superclass

Computers and Technology
1 answer:
wlad13 [49]3 years ago
5 0

Answer:

Explanation:

The following code is written in Java. It creates the three classes mentioned and a Tester class that contains the main method. The Computer class contains the memory variable since both laptops and Desktops need memory. The screen size variable is placed separately in the Laptop and Desktop class since desktops may or may not have a monitor so this variable cannot be placed in the Computer class. The batteryLife variable is only in the Laptop class because Desktops do not have batteries. Finally, the monitor variable is only placed in the Desktop class since Laptop's come with built-in monitors. The tester class seen in the picture below tests the creation of both of these objects and it executes without any error.

class Computer {

   int memory;

   public int getMemory() {

       return memory;

   }

   public void setMemory(int memory) {

       this.memory = memory;

   }

}

class Laptop extends Computer {

   int screenSize;

   double batteryLife;

   public int getScreenSize() {

       return screenSize;

   }

   public void setScreenSize(int screenSize) {

       this.screenSize = screenSize;

   }

   public double getBatteryLife() {

       return batteryLife;

   }

   public void setBatteryLife(double batteryLife) {

       this.batteryLife = batteryLife;

   }

}

class Desktop extends Computer {

   boolean monitor;

   int screenSize;

   public boolean isMonitor() {

       return monitor;

   }

   public void setMonitor(boolean monitor) {

       this.monitor = monitor;

   }

   public int getScreenSize() {

       return screenSize;

   }

   public void setScreenSize(int screenSize) {

       this.screenSize = screenSize;

   }

}

class Tester {

   public static void main(String[] args) {

       Laptop computer1 = new Laptop();

       Desktop computer2 = new Desktop();

   }

}

You might be interested in
T F Changes to a function parameter always affect the original argument as well.
Leya [2.2K]

Answer:

False

Explanation:

"When the function addition is called, [...] any modification will not have any effect [...]in the values outside it, because variables x and y were not themselves passed to the function, but only copies of their values at the moment the function was called."

Reference: Cplusplus.com. “Functions (II).” Cplusplus.com, 2019,

6 0
3 years ago
How many bits are used to direct traffic to specific services running on a networked computer?
Mars2501 [29]

Answer:

The correct answer is 16 bit.

Explanation:  

The main role of the transport layer provided the communication channel of the process which are running in a different host. When the information flows there is always traffic that is arisen but the transport layer aimed is that process will go at the correct node and received at the proper destination. The 16-bit number specifies that the process or node is running in the networked traffic.

3 0
3 years ago
Subscribe too my you tube channel for a brainiest
dimaraw [331]

Answer:

Ok

Explanation:

4 0
2 years ago
Could someone please help me with this?
Alexxandr [17]

Answer:

See explanation

Explanation:

Given

if(fish > 400) {

Required

What is the condition checking?

The above statement is an if conditional statement. Analysing the statement in bits:

if -> This represents the beginning of the conditional statement

fish -.> The variable that is being checked

> 400 -> The condition which the variable is being measured by.

So, the statement above is checking if the value of variable fish is greater than 400.

<em>If the condition is true, the instructions associated to that if statement will be executed.</em>

7 0
2 years ago
Did this technological advancement take away or create jobs? Overall, what was the contribution of this technological advancemen
mars1129 [50]
It took away jobs and made day to day tasks easier
3 0
3 years ago
Other questions:
  • 4. When you're working with a word processing document and you press the Del key, what happens?
    8·2 answers
  • Which service is enabled on a cisco router by default that can reveal significant information about the router and potentially m
    10·1 answer
  • Describe what is meant by the following:
    14·1 answer
  • We will pass in 2 values, X and Y. You should calculate XY XY and output only the final result. You will probably know that XY X
    13·1 answer
  • Ebba received a message from one of her tech support employees. In violation of company policy, a user had downloaded a free pro
    14·1 answer
  • From which type of data storage does the CPU load information for processing during normal operation?
    14·1 answer
  • Do u have all the subjects​
    12·2 answers
  • When browsing using certain browsers, if a page is known to be malicious or using phishing techniques in the past a browser may
    5·1 answer
  • Lasses give programmers the ability to define their own types. <br><br> a. True<br> b. False
    10·1 answer
  • Place the steps for attaching a file to a message in order from top to bottom.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!