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
Juliette [100K]
3 years ago
15

Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class Win

dowWithBorder that contains a single additional integer instance variable named borderWidth, and has a constructor that accepts an integer parameter which is used to initialize the instance variable. There is also a function getUseableWidth, that returns the width of the window minus the width of the border.
Computers and Technology
1 answer:
Pepsi [2]3 years ago
5 0

Answer:

Following are the code in the C++ Programming Language.

//define class and inherited the parent class

class WindowWithBorder : public Window

{

//access modifier

private:

//set integer variable

int borderWidth;

//set integer variable

int windowWidth;

//access modifier

public:

//definition of the constructor that accept an integer type argument

WindowWithBorder(int);

//definition of the function

int getUseableWidth();

};

//set constructor outside the class

WindowWithBorder::WindowWithBorder(int y)

{

//initialization in integer variable from function

windowWidth = getWidth();

//initialization in integer variable from the argument list

borderWidth = y;

}

//set function from outside the class

int WindowWithBorder::getUseableWidth()

{

//return output

return windowWidth - borderWidth;

}

Explanation:

Here we define a class "WindowWithBorder" which inherit their parent class "Window", inside the class.

  • Set two integer data type private variables "borderWidth" and "windowWidth".
  • Write the definition of the "windowWidth" class constructor that accept the integer type argument list.
  • Write the definition of the function "getUseableWidth()" which is integer type.

Then, we define constructor outside the class which accept the integer type argument list "y" inside it.

  • we initialize in the variable "windowWidth" from the function "getWidth()".
  • Initialize in the variable "borderWidth" from the argument of the constructor.

Finally, we define function in which we perform the subtraction of the variable "windowWidth" from the variable "borderWidth" and return it.

You might be interested in
Write a program in java to enter a character.The program displays the message "uppercase vowel" if entered character is uppercas
horrorfan [7]

Answer:

d

Explanation:

i think

3 0
3 years ago
Define Turbo C++ and how is the use of Turbo C++.?
anyanavicka [17]

Answer:

Turbo C++ is a Compiler and Integrated development Environment (IDE) and Computer language

Explanation:

  1. Turbo C++ is a IDE which is used for writing the programs.
  2. This editor is used to create the source file, compile and run the source file and then execute it

6 0
3 years ago
Write a flowchart and C code for a program that does the following: Uses a do...while loop. Prints the numbers from 1 to 10 with
emmasim [6.3K]

Answer:

create the integer variable and initialize it to one, with the do statement, increment the variable by one and print it, then the while statement checks if the variable is less than or equal to 10.

#include <iostream>

using namespace std;

int main(){

   int i = 1;

   do {

       cout<< i << "\n";

       i++;

   }

   while (i <= 10);

}

Explanation:

The C++ source code initializes the integer variable i to one and increments and print the value if the value is less than or equal to ten. The do-while statement executes a block of code before the condition is implemented.

4 0
3 years ago
The following outline is used to plan a program. What is the name for this type of plan?
vladimir1956 [14]
Pseudocode is the answer
7 0
3 years ago
Read 2 more answers
HELPPP!!! ASAP *What are the purposes of a good web page?*
Brrunno [24]

I would say functional and straightforward

4 0
3 years ago
Other questions:
  • A word or line of a paragraph at the top of a page hanging indent is called ______
    8·1 answer
  • Checking tire pressure should be performed:
    11·2 answers
  • A/an ___________ is a scheduling tool that sets the standard and nonworking time for the project and is used to assess how tasks
    6·1 answer
  • When a rectangular region is defined using an appropriate style, which value matches the specified edge of the clipping region t
    7·1 answer
  • For each of these statements find a domain for which the statement is true and a domain for which the statement is false. a) Eve
    13·1 answer
  • Lexi wants to buy a $300 painting. when she gets to the store, she finds that it is on sale for 40% off. how much does Lexi spen
    10·1 answer
  • What would a bar graph best be used for? State why and give 2-3 examples of things you could demonstrate with a bar graph
    5·1 answer
  • What happens when the electrons flowing through the light bulb change direction?
    11·1 answer
  • Question 1 (1 point)
    9·1 answer
  • (C) Describe about the different types of computer<br> peripherals and memory devices.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!