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
Modify the countUp( ) you wrote in the previous question to countUp( num), where num is a parameter. The function displays from
algol [13]

Answer:

void countUp(int num)

{

   if(num==0) //base case.

   return;

   countUp(num-1);//Recursive call.

   cout<<num<<" "; //printing the number.

}

for input num=25

Output:-1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Explanation:

I have used recursion to print the numbers the function is in c++ language.In every recursive call we are decreasing num by 1.As the base case is reached.Then it will backtrack from 1 to num and then we are printing while backtracking.

4 0
3 years ago
Identify the data set level of measurement for the following: individual tax filing status (single, head of household, widowed,
Snowcat [4.5K]

Answer:

Option (B) Nominal is the correct option.

Explanation:

Nominal data set is the set of the heights of data measurement for the particular tax filing status. It also used for the labeling of the variables without allowing them to the quantitative data type. So, that's why the following option is correct.

Other options are wrong because the following statement is related to the Nominal data set.

6 0
3 years ago
Need the answer ASAP plz !!!!!
Evgesh-ka [11]
Performance would be the answer
3 0
3 years ago
Write a statement that outputs variable numObjects. End with a newline.
dalvyx [7]

Answer:

The code is witten in Java and given in the explanation section.

Using a Scanner object we receive a the user's input and with the System.out.println we output the variable

Explanation:

import java.util.Scanner;

public class VariableOutput{

   public static void main (String [] args){

       Scanner input = new Scanner(System.in);

       System.out.println("Enter an Integer 15 or 40");

       int numObjects = input.nextInt();

       System.out.println("You entered the number "+numObjects);

   }

}

7 0
3 years ago
In modern computer systems, a byte consists of
Cerrena [4.2K]
8 smaller units, called bits :)
8 0
3 years ago
Other questions:
  • The layout button is located in the ____ group on the home tab?
    14·1 answer
  • Very large and very small numbers are easier to write in scientific notation. For example, the number, 0.000000728 would be writ
    7·1 answer
  • Routers: operate at the application layer operate only at the physical layer cannot connect two or more networks that use the sa
    5·1 answer
  • Pls help! ive been looking everywhere online but I couldn't find the answer to this:
    5·1 answer
  • What is the function of the command prompt?
    8·1 answer
  • Select the correct answer.
    15·1 answer
  • True or false a computer with a high efficiency rating should stay cooler than one with a low effiency rating
    9·1 answer
  • When should you create an outline?
    11·1 answer
  • (b) In Scratch, the instruction 'when I receive' enables us to _____ the action of multiple sprites ​
    5·1 answer
  • Discuss the ways you can perform to prevent your computer/device and its data/contents from being stolen. Define two-facto authe
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!