Define a derived class  WindowWithBorder 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.

C++

LANGUAGE: C++ CHALLENGE: Assume  the existence of a Window class  with a function getWidth that returns the width of the window. Define a derived class  WindowWithBorder 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…

Read More

Define a derived class , ApartmentBuilding that contains four (4) data members: an integer  named  numFloors, an integer  named  unitsPerFloor, a boolean  named  hasElevator, and a boolean  named  hasCentralAir. There is a constructor  containing parameters  for the initialization  of the above variables  (in the same order as they appear above).

C++

LANGUAGE: C++ CHALLENGE: Assume  the existence of a Building class . Define a derived class , ApartmentBuilding that contains four (4) data members: an integer  named  numFloors, an integer  named  unitsPerFloor, a boolean  named  hasElevator, and a boolean  named  hasCentralAir. There is a constructor  containing parameters  for the initialization  of the above variables  (in the same order…

Read More

Define a derived class , CameraPhone that contains two data members: an integer  named , imageSize, representing the size in megapixels of each picture, and an integer  named  memorySize, representing the number of gigabytes in the camera’s memory.

C++

LANGUAGE: C++ CHALLENGE: Assume  the existence of a Phone class . Define a derived class , CameraPhone that contains two data members: an integer  named , imageSize, representing the size in megapixels of each picture, and an integer  named  memorySize, representing the number of gigabytes in the camera’s memory. There is a constructor  that accepts two integer  parameters …

Read More

Write a recursive, bool-valued  function, containsVowel, that accepts a string  and returns true  if the string  contains a vowel.

C++

LANGUAGE: C++ CHALLENGE: Write a recursive, bool-valued  function, containsVowel, that accepts a string  and returns true  if the string  contains a vowel. A string  contains a vowel if: The first character  of the string  is a vowel, or The rest of the string  (beyond the first character ) contains a vowel

Read More

Assume the existence of a BankAccount class . Define a derived class , SavingsAccount that contains two instance variables : the first a double , named interestRate, and the second an integer named interestType.

C++

LANGUAGE: C++ CHALLENGE: Assume  the existence of a BankAccount class . Define a derived class , SavingsAccount that contains two instance variables : the first a double , named  interestRate, and the second an integer  named  interestType. The value  of the type  variable  can be 1 for simple interest and 2 for compound interest. There is also a constructor …

Read More

Write the definition of a function called product.

C++

LANGUAGE: C++ CHALLENGE: Write the definition of a function called product . The function receives two int parameters. You may assume  that neither parameter  is negative. The function returns the product  of the parameters . So, product (3,5) returns 15 and product (30,4) returns 120. The function must not use a loop of any kind…

Read More