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
Natasha2012 [34]
3 years ago
12

The 'client area' of a window is the area used to display the contents of the window (thus a title bar or border would lie outsi

de the client area). For the Window class, the client area is nothing more than the entire window, and thus the height of the client area is nothing more than the value of the height instance variable.
Assume the existence of a Window class with existing methods, getWidth and getHeight. There is also a Window subclass, named TitledWindow that has an integer instance variable barHeight, containing the height of the title bar.
Write the method getClientAreaHeight for the TitledWindow class that returns the height (an integer) of the client area of a window with a title bar.
Computers and Technology
1 answer:
Stolb23 [73]3 years ago
6 0

Answer:

The Java code is given below

Explanation:

<u>Window.java: </u>

public class Window {

private int width, height;

public Window(int width, int height) {

this.width = width;

this.height = height;

}

public int getHeight() {

return height;

}

public void setHeight(int height) {

this.height = height;

}

public int getWidth() {

return width;

}

public void setWidth(int width) {

this.width = width;

}

@Override

public String toString() {

return "Window [width=" + width + ", height=" + height + "]";

}

}

<u>TitledWindow.java: </u>

public class TitledWindow extends Window {

private int barHeight;

public TitledWindow(int width, int height, int barHeight) {

super(width, height);

this.barHeight = barHeight;

}

public int getClientAreaHeight() {

return barHeight + super.getHeight();

}

@Override

public String toString() {

return "TitledWindow [width=" + super.getWidth() + ", height=" + super.getHeight() + ", barHeight=" + barHeight + "]";

}

}

<u>TestWindows.java: </u>

public class TestWindows {

public static void main(String args[]) {

Window w = new Window(450, 200);

System.out.println("Window: " + w);

TitledWindow titledWindow = new TitledWindow(450, 200, 30);

System.out.println("titaledWindow: " + titledWindow);

System.out.println("titledWindow.height: " + titledWindow.getClientAreaHeight());

}

}

You might be interested in
2. Which of the following does NOT make driving more dangerous at night?
katrin2010 [14]

Answer:

D. THE PRESENCE OF TRAFFIC LIGHTS

Explanation:

THEY HELP GUIDE US AND HELP US BE MORE AWARE OF TRAFFIC.

4 0
3 years ago
Read 2 more answers
The region of the sky which reflects radio waves around the world is the .
aivan3 [116]

The ionosphere reflects those waves

6 0
3 years ago
What is the default extension of Q Basic program file? ​
KonstantinChe [14]

Answer:

Bas

Files written with QBASIC must be run using the program and have the "bas" file extension.

Hope this helps

#Carryonlearning

8 0
2 years ago
2. Identify two real-world examples of problems whose solutions do not scale well.
DiKsa [7]

Answer:

The specification is defined downwards according to the conclusions reached.

Explanation:

Real-world instances or examples of issues that do not scale well are listed following table:

  • For different uses, such as solving the equation, respectively., multiplication matrices.
  • It still does not scales or works well to organize a wide sequence of names or numbers as the requisite measures raise as squares by around the enlargement or increment.
7 0
2 years ago
It is a group of two or more computer system connect to each other​
Sedbober [7]

network is a group of two or more computer system connected together

8 0
2 years ago
Other questions:
  • Suppose an instruction takes 4 cycles to execute in an unpipelined CPU: one cycle to fetch the instruction, one cycle to decode
    10·1 answer
  • The United States Highway System is a _____________ in the United States numbered within a nationwide grid.
    9·1 answer
  • Which course must first-time drivers in Florida take to be eligible for their Learner License?
    11·1 answer
  • Which ergonomic principle helps to maintain good posture?
    8·2 answers
  • Molly, a technician, has been tasked with researching an emulator for the software developers to test cross-platform application
    13·2 answers
  • Which two standards below represent newer versions of stp??
    13·1 answer
  • AtlasNow Construction Company, a general contractor, plans to place a bid for building a hospital. It requests bids from subcont
    12·1 answer
  • Betty set up an account on a popular social networking website. she wants to know whether the privacy policy is effective for he
    14·1 answer
  • Which of the following is not a key component of a structure?
    12·1 answer
  • Smart art can be used to create that highlight relationships between two items
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!