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
Giải thích mục đích của các thao tác open() và close().
kicyunya [14]

Answer:

Which lan is it

8 0
2 years ago
Read 2 more answers
Hello people, I was wandering if I could get some people to complete this questionnaire for my business course. It would be very
madam [21]
What do I have to do
3 0
3 years ago
What does an effect allow you to do in<br> EarSketch?
Gnoma [55]

Answer:usbebdos did did I’d did d

Explanation:

Bash six ska over five. I did a sis a and

7 0
3 years ago
During project management, who executes tasks and produces the deliverables as stated in the project plan and as directed by the
san4es73 [151]
B. Project team members
8 0
3 years ago
Assume that the following variables have been properly declared and initialized.
grandymaker [24]

Answer:

       if (option1.equals(option2)){

           rsvp = true;

       }

       System.out.println(rsvp);

A full program is given in the explanation section

Explanation:

import java.util.Scanner;

public class Option {

   public static void main(String[] args) {

       boolean rsvp = false;

       int selection;

       String option1,option2;

       Scanner in = new Scanner(System.in);

       option1 = in.next();

       option2 = in.next();

       if (option1.equals(option2)){

           rsvp = true;

       }

       System.out.println(rsvp);

   }

}

4 0
3 years ago
Other questions:
  • What happens if you give false information on your driver license application?
    12·1 answer
  • An important safety precaution you should take before starting any electrical servicing job is to make sure that your
    15·2 answers
  • Hello, can you help me answer these questions?
    9·2 answers
  • Windows 1.0 was not considered to be a "true" operating system but rather an operating environment because _____.
    13·1 answer
  • Define the following BASIC terms:<br> 1. Keywords<br> 2. Constants<br> 3.Variables
    8·1 answer
  • Sorry but, what are brainliest for?
    7·2 answers
  • Which command is used to copy entire folder structures between volumes or across a network while maintaining all NTFS file permi
    10·1 answer
  • Write a function solution that, given an array A consisting of N integers, returns the number of fragements of A whose sum equal
    9·1 answer
  • Pls help will give brainlest!!! The image shows a line graph. Which scientist is most likely to use this visual aid in a present
    15·1 answer
  • You learned that "The CPU interacts with memory in a process that is known as
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!