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
kirill115 [55]
3 years ago
13

All windows on the desktop have width and height (as well as numerous other attributes). However the actual contents of the wind

ow change both in structure and appearance depending upon what sort of window is displayed (e.g. a word processing window will display text, a color chooser window display a pallette of colors, a file chooser window displays a directory tree, etc). Thus, the details of the method to actual fill the contents of the window must be deferred to the subclasses of the Window class Write the definition of an abstract class, Window, containing the following: two integer instance variables, width and height, two accessor methods, getWidth and getHeight, a constructor that accepts two integers and uses them to initialize the two instance variables (the parameters should be width followed by height), and an abstract void-returning method named paint that accepts no parameters.
Computers and Technology
1 answer:
Cerrena [4.2K]3 years ago
6 0

Answer:

The abstract class Window:

public abstract class Window

Two integer instance variables, width and height:

private int width, height;

Two accessor methods, getWidth and getHeight:

public int getWidth()

public int getHeight()

A constructor that accepts two integers and uses them to initialize the two instance variables:

public Window(int var1, int var2) {width =var1; height = var2;}

An abstract void-returning method named paint that accepts no parameters

public abstract void paint();

Explanation:

Abstract keyword is used with Windows class to make this class an abstract class which means no object can be created using this class.

Two private instance variable width and height. Private means they are not accessible outside this class.

Then getWidth and getHeight methods are used to return width and height.

The constructor takes two integer type variables var1 and var2. These two variable are used to initialize the variables width and height. Constructor has the same name as that of the class.

Method paint() is an abstract method with the return type void which has no parameters.  

So here is what the class with all its methods and instance variables looks.

public abstract class Window {

private int width, height;

public Window(int a, int b) {width = a; height = b;}

public int getWidth(){ return width; }

public int getHeight(){ return height; }

public abstract void paint();

}

You might be interested in
What is the approximate time and death in Sherlock Holmes
kati45 [8]

Answer: 8:58.5204 o'clock a.m

:)

3 0
2 years ago
Read 2 more answers
I need help with the stalk holders project
anygoal [31]

Answer:

A project is successful when it achieves its objectives and meets or exceeds the expectations of the stake­holders. But who are the stakeholders? Stakeholders are individuals who either care about or have a vested interest in your project. They are the people who are actively involved with the work of the project or have something to either gain or lose as a result of the project. When you manage a project to add lanes to a highway, motorists are stakeholders who are positively affected. However, you negatively affect residents who live near the highway during your project (with construction noise) and after your project with far-reaching implications (increased traffic noise and pollution).

Explanation:

6 0
3 years ago
Please code in python and add comments to code
Gnoma [55]

#accepting input from user

n=int(input("Enter a number: "))

#entered number is stored in a temporary variable

temp=n

#initializng required variables

rev=0

dgt=0

#digits are reversed inside while loop

while(n>0):

dgt=n%10

rev=rev*10+dgt

n=n//10

#original number and its reverse are compared

if(temp==rev):

#if equal, it's a palindrome

print("It is a Palindrome")

else:

#if not equal, it's not a palindrome

print("It is not a Palindrome")

#◌⑅⃝●♡⋆♡Nåmřāthā♡⋆♡●⑅◌

4 0
2 years ago
What qualities in an employee are highly desired by employers?
slava [35]
Flexibility and open-mindedness
being quick to adapt to technology changes
having a positive attitude
taking initiative to solve problems
5 0
3 years ago
Read 2 more answers
Janet has to prepare a presentation on business strategies for work. Which guideline should she follow to create an effective pr
Tpy6a [65]

d.....................................


7 0
3 years ago
Read 2 more answers
Other questions:
  • An administrator has just added a new update to the WSUS server and she wants to test the update to the test group. Which of the
    9·1 answer
  • What is the difference between an embedded image and an attached image
    7·2 answers
  • The third wave of computing was characterized by the introduction of _____.
    10·1 answer
  • What does it mean to compact and repair your database? What is the difference between a single
    15·1 answer
  • Which is an example of an incremental approach to solving a problem?
    15·1 answer
  • What is the location used by users to configure delegate access on their own mailboxes? Backstage view > Account Settings Bac
    12·1 answer
  • Who has the wrong anwser
    14·2 answers
  • One reason it is important to write code that is readable is that
    8·2 answers
  • What online resource would you use if you wanted to read a review about a new movie?
    8·1 answer
  • A. Mohit has bought a new laptop. The laptop is not working as no software is installed in
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!