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
Steps to run a Q-BASIC programme<br>​
jarptica [38.1K]

Answer:

Cls

Read

Input

Print

END

5 0
3 years ago
Zohan uses the following analogy to describe a concept of object-oriented programming. A button can have many uses. When it is p
Vika [28.1K]

Answer:

Polymorphism

Explanation:

You can have a basic button class that gets inherited by other classes.

class Button {

function pushButton(){}

}

class ElevatorButton extends Button{};

class BigRedButton extends Button{};

With these new classes, they inherit from the basic button class. They can decide what happens when the method pushButton() is called.

You don't need to worry about what pushButton() actually does, you can just call it if the object is of the type "Button" and you can expect it to work.

4 0
2 years ago
Lorann sends messages to Aiden that always go into Aiden's Junk E-mail folder. Which process would best correct this problem so
BaLLatris [955]
Go to settings and find out.
7 0
3 years ago
What is RAM? explain it
Zina [86]
RAM is memory in the computer
3 0
3 years ago
Read 2 more answers
What are the advantages of customer relationship managment​
Delvig [45]

Answer:

Enhances Better Customer Service.

Facilitates discovery of new customers.

Increases customer revenues.

Helps the sales team in closing deals faster.

Enhances effective cross and up-selling of products.

Simplifies the sales and marketing processes.

Makes call centers more efficient.

Enhances customer loyalty.

3 0
3 years ago
Other questions:
  • When desktop publishing software can interact with another software program, the two are said to
    6·1 answer
  • State one advantage of organising data into columns and rows
    11·1 answer
  • What is a digital certificate? Select one: a. It is a means of establishing the validity of an offer from a person, entity, web
    7·1 answer
  • Liam and his friend are regular viewers of their favorite podcast about photography techniques. What is the best way for them to
    15·1 answer
  • A manufacturing company inspects all products before selling them. Less than 1% are defective and do not pass inspection. You ar
    9·1 answer
  • The technology dealing with robots is called
    6·1 answer
  • You have a network that occupies the top floor of a three-story building. The WAN service provider has installed the line for th
    11·1 answer
  • SOMEONE HELP PLEASE ​
    5·1 answer
  • Given the number of every players of two cricket team to find the winner team and find total half-century,in C program
    14·1 answer
  • give the tightest asymptotic bounds you can for the following recurrences and provide a short explanation for your solution. you
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!