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
What is the purpose of a forecast worksheet?
Liono4ka [1.6K]

Answer: It’s a

Explanation:

I got it right on edj

8 0
2 years ago
It is not possible to use keywords to search for themes. true or false.
Drupady [299]
False my dude .........................
3 0
3 years ago
What is the next line? &gt;&gt;&gt; tupleB = (5, 7, 5, 10, 2, 7) &gt;&gt;&gt; tupleB.count(7) 1 0 5 2
dybincka [34]

Answer:

The right answer is option 4: 2

Explanation:

Lists are used in Python to store elements of same or different data types.

Different functions are used in Python on List. One of them is count.

Count is used to count how many times a specific value occurs in a list.

The syntax for count is:

listname.count(value)

In the given code,

The output will be 2

Hence,

The right answer is option 4: 2

3 0
2 years ago
Write a Java program that reads an 8-bit binary number from the keyboard as a string and then converts it into decimal. For exam
cestrela7 [59]

Answer:

public class Brainly

{

 public static void main(String[] args)

 {

   BinaryConverter conv = new BinaryConverter();

   String binStr = "01001101";

   System.out.print(binStr + " in decimal is "+conv.BinToDec(binStr));

 }

}

public class BinaryConverter

{

 public int BinToDec(String binStr)

 {

   int d = 0;

   while(binStr.length() > 0)

   {

     d = (d << 1) + ((binStr.charAt(0) == '1') ? 1: 0);

     binStr = binStr.substring(1);

   }

   return d;

 }

}

Explanation:

The program "eats" the string from left to right, and builds up the integer representation in variable "d" on the go. While there are digits left, it shifts the previous result to the left and sets the least signficant bit to 1 only if the corresponding string character is a 1.

5 0
3 years ago
What kind of word is the pronoun in bold letters?
tresset_1 [31]

Answer:

Subject

Explanation:

The kind of word that is pronoun in bold letters is "Subject".

In Example

We get our paychecks on Friday, and I always need mine.

There We and I are subjects.

5 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is a narrative essay most like
    8·2 answers
  • Conceptual note-taking is the act of
    15·1 answer
  • The material chosen for your study group
    11·1 answer
  • 3. Find the product of (a² +3a+5) x (a+7)​
    7·1 answer
  • What steps might a company or organization need take in order to keep its digital data secure online?
    8·1 answer
  • An ____ is an object that produces each element of a container, such as a linked list, one element at a time.
    13·2 answers
  • Write: In a five-paragraph essay that is two to three pages in length, address the
    13·1 answer
  • The photo shows a group of girls reacting to comments they have read about a classmate on a social media site.
    10·1 answer
  • PLEASE HELP WILL MARK BRAINLIEST
    8·2 answers
  • eocs can be fixed locations, temporary facilities, or virtual structures with staff participating remotely.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!