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 type of purchase requisition is used to turn-in a recoverable/reparable material to the ssa?
m_a_m_a [10]

ZRX is the purchase requisition document type used to turn a recoverable repairable material for Remote customers to the SSA.

What is a purchase requisition?

Employees can start a purchase by sending internal documents called buy requisitions. A buy order is issued to a supplier to place the order for the goods/services in question once the purchase has received the relevant person or department's approval.

What is the purpose of a purchase requisition?

A purchase request form is a formal internal document that is utilized during the purchasing process. Employees utilize this to communicate the resources they require to department supervisors. Therefore, an employee will submit a formal request via a requisition form to the purchasing department if they have a requirement.

Learn more about purchase requisition: brainly.com/question/16413109

#SPJ4

5 0
2 years ago
You can use the ____ utility to zero in on the service or other program that is slowing down startup. 1. gpupdate 2. MSconfig 3.
Step2247 [10]
I'd say MSconfig, you can use that and view the 'processes' tab, but it will make you open up the task manager.
3 0
3 years ago
चार फरक छुट्याउनुहोस् ।) 3. Write down any four provisions of cyber ethic साइबर नैतिकताका कुनै चार प्रावधानहरु लेख्नुहोस् ।​
Kruka [31]

Answer:

Five provisions of cyber ethics are:

Your computer or system should not be used to harm others. Your cyber knowledge should not be used to steal other people's resources. One should not use or copy softwares for which you have not paid. ... Never use other people's resources without their consent.

7 0
2 years ago
Lionbridge theory test
marishachu [46]
What about it kidddddd
4 0
3 years ago
Read 2 more answers
Write a generator function named count_seq that doesn't take any parameters and generates a sequence that starts like this: 2, 1
-BARSIC- [3]

Answer:

#required generator function

def count_seq():

   #starting with number 2. using string instead of integers for easy manipulation

   n='2'

   #looping indefinitely

   while True:

       #yielding the integer value of current n

       yield int(n)

       #initializing an empty string

       next_value=''

       #looping until n is an empty string

       while len(n)>0:

           #extracting first digit (as char)

           first=n[0]

           #consecutive count of this digit

           count=0

           #looping as long as n is non empty and first digit of n is same as first

           while len(n)>0 and n[0]==first:

               #incrementing count

               count+=1

               #removing first digit from n

               n=n[1:]

           #now appending count and first digit to next_value

           next_value+='{}{}'.format(count,first)

       #replacing n with next_value

       n=next_value

#testing, remove if you don't need this

if __name__ == '__main__':

   #creating a generator from count_seq()

   gen=count_seq()

   #looping for 10 times, printing next value

   for i in range(10):

       print(next(gen))

Explanation:

6 0
3 years ago
Other questions:
  • How can you best protect yourself when using social media
    5·2 answers
  • Select all that apply.
    8·2 answers
  • Most large organizations store data through a strategy called a(n) ________ to promote efficient and safe use of data across the
    11·1 answer
  • A new product was introduced in 2003, which functions as both an identification device and a medium of communication. It uses in
    8·1 answer
  • What is the "online disinhibition effect"?​
    7·1 answer
  • In which of the following phases of filmmaking would a production team be focused on the
    10·2 answers
  • What are the four steps for planning a table?​
    10·1 answer
  • LaShawn would like to post photos in a social media app, but the program needs to be modified in order to display a greater vari
    12·2 answers
  • Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
    10·1 answer
  • Como interactua el hardware de la computadora con el ser humano
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!