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
ozzi
3 years ago
15

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. Assuming the existence of a Window class with existing methods, getWidth and getHeight, add the method getClientAreaHeight that returns the height (an integer) of the client area of the window.
Computers and Technology
1 answer:
Lady_Fox [76]3 years ago
4 0

Answer:

<u>Window.java</u>

  1. public class Window {
  2.    int width;
  3.    int height;
  4.    public Window(int width, int height){
  5.        this.width = width;
  6.        this.height = height;
  7.    }
  8.    public int getWidth(){
  9.        return width;
  10.    }
  11.    public int getHeight(){
  12.        return height;
  13.    }
  14.    public int getClientAreaHeight(){
  15.        return getHeight();
  16.    }
  17. }

<u>Main.java</u>

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        Window win1 = new Window(12, 15);
  4.        System.out.println(win1.getClientAreaHeight());
  5.    }
  6. }

Explanation:

<u>Window.java</u>

There is a Window class with two int type attributes, width and height (Line 1 - 3).

The constructor of this class will take two inputs, width and height and set these input to its attributes (Line 5 - 8). There are two methods getWidth and getHeight which will return the value of attributes width and height, respectively (Line 10 - 16).

The required new method getClientAreaHeight is defined in line 18 -20. This method will call the getHeight method to return the height value of the window (Line 19).

<u>Main.java</u>

We test the Window class by creating one Window instance and call the getClientAreaHeight method and print the return output (Line 1 -6).

We shall see 15 is printed.

You might be interested in
What was one important academic skill the blogger learned?
denis23 [38]

An academic skill that the blogger learned, was to review the graded tests and quizzes to see which concepts he missed out on so that in the future he would be well prepared for it. Reviewing and comparing the tests and quizzes would give him an idea on which topics he needs to study.

Other than the academic skill, the blogger also learned that a person should never give up and he keeps on learning throughout his entire life, and that all of the improvements that the blogger made did not come all at once.

4 0
3 years ago
What is the shortcut to select all text?
abruzzese [7]
Highlight everything with your curser.
7 0
3 years ago
Read 2 more answers
What is one difference between the Simple Gear Train with Same Size Gears and Simple Gear Train with Different Size Gears?
polet [3.4K]

Answer:

One difference between a Simple Gear train with Same Size Gears and Simple Gear Train with Different Size Gears is the that the number of rotations of both shafts in the Simple Gear Train with Same Size Gears is the same the number of rotations of both shafts in the simple Gear Train with Different Size Gears are different

Explanation:

A simple gear train is one in which each shaft has only one shaft, and the motion of one shaft in transmitted to the other when the gears are in contact

5 0
2 years ago
In the MARS Marketing Management Simulation, the results of your marketing mix decisions:
azamat
C- are only occasionally affected by the decisions made by other teams
explanation
idk
3 0
3 years ago
PLEASEEEE PLEASEEE HELPPPP
olga nikolaevna [1]

Explanation:

you need a better pic if possible, it's kinda hard to read the question.

4 0
3 years ago
Other questions:
  • "what are the problems with tcp over wireless network?"
    15·1 answer
  • Write the sql command to show which tutor needs to be reminded to turn in reports.
    13·1 answer
  • Line spacing refers to the amount of space between each line in a paragraph. A. True B. False
    14·2 answers
  • The term "resolution" refers to ______.
    6·2 answers
  • Using python:
    10·1 answer
  • What is Java Script?
    13·1 answer
  • When locating and correcting accessibility issues for a document, you would click what first?
    11·1 answer
  • The email_list function receives a dictionary, which contains domain names as keys, and a list of users as values. Fill in the b
    14·1 answer
  • How was science used to make television?
    6·2 answers
  • What commands does SuperKarel know that regular Karel does not?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!