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
viktelen [127]
3 years ago
15

Create a derived class called TestPerson, which publically inherits from class Person. Create test methods for each method in cl

ass Person. Remember these functions should not accept any parameters or return any values. However, they should print messages for "test case passed" or "test case failed".
Computers and Technology
1 answer:
Viktor [21]3 years ago
7 0

Answer:

class TestPerson : public Person {

private:

  string test_name;

  int test_age;

  char test_gender;

  float test_height;

public:

  TestPerson (string name, int age, char gender, float height) : Person(name, age, gender, height) {

      this -> test_name = name;

      this -> test_age = age;

      this -> test_gender = gender;

      this -> test_height = height;

  }

  void testSetName() {

      test_name = "qwerty";

      setName(test_name);

      if (name.compare(test_name) == 0)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testSetAge() {

      test_age = 999;

      setAge(test_age);

      if (age == test_age)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testSetGender() {

      test_gender = 'X';

      setGender(test_gender);

      if (gender == test_gender)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testSetHeight() {

      test_height = 100.563f;

      setHeight(test_height);

      if (height == test_height)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testGetName() {

      if (getName().compare(test_name) == 0)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testGetAge() {

      if (getAge() == test_age)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testGetGender() {

      if (getGender() == test_gender)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

  void testGetHeight() {

      if (getHeight() == test_height)

          cout << "Test passed";

      else

          cout << "Test failed";

  }

}

You might be interested in
A robot worker and a human worker are both vulnerable to
Lady bird [3.3K]

Answer:

fire

Explanation:

4 0
4 years ago
¿Por qué es importante usar adecuadamente el celular?
posledela

Answer:

to stop it from breaking

Explanation:

5 0
3 years ago
Which of the following commands can be used to display socket information out to the terminal screen
Slav-nsk [51]
Linus ss

Explanation:

The ss (socket statistics) command provides a lot of information by displaying details on socket activity. One way to get started, although this may be a bit overwhelming, is to use the ss -h (help) command to get a listing of the command's numerous options. Another is to try some of the more useful commands and get an idea what each of them can tell you.

One very useful command is the ss -s command. This command will show you some overall stats by transport type. In this output, we see stats for RAW, UDP, TCP, INET and FRAG sockets.
6 0
2 years ago
Practicing touch typing allows you to create documents efficiently and accurately.
Marysya12 [62]
I think the answer to this would be true
8 0
3 years ago
Which of the following best describes the safety of blogging
Pavlova-9 [17]
We need the options
3 0
3 years ago
Other questions:
  • Deterime the minimum number of multiplication operations needed to compute the following. Show the order of the computations.
    10·1 answer
  • Dora electronically transferred $591.68 from her checking account to Matt's checking account. In what column of the check regist
    14·2 answers
  • Order the following routine maintenance tasks from most to least important when securing a computer. a. Verify anti-malware sett
    15·1 answer
  • In a car crash, wearing a seat belt __________________.
    5·2 answers
  • The calculation of the likelihood of an attack coupled with the attack frequency to determine the expected number of losses with
    12·1 answer
  • When reading words using a Scanner object's next method, _________. a. any characters at the beginning of the input that are con
    5·1 answer
  • What is HTML? (list down any 5 points)
    12·1 answer
  • What word can you type using only the left home row keys and the right reach keys?
    6·2 answers
  • what is the correct process for setting up a recurring project for the same client in qbo accountant?
    14·1 answer
  • HELP!!!!!!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!