Question: In C++ language. Assignment 2 Use your Human class from the previous assignment 1(which I have included at the end of these instructions ) then

In C++ language.

Assignment 2

Use your Human class from the previous assignment 1(which I have included at the end of these instructions ) then create a People class to hold a list of Humans.

The People class holds an unsorted list of humans. Initially, this list is empty. Existing Human objects may be added to the list using an insert method. Upon inserting a Human object, it is added to the array at the next available position and the position value in incremented. If the position value is equal to the size value, do not insert the Human. Instead, throw an exception that your driver can catch to print an error that the People object is full.

People class Create a People class with the following features:

Each People object has a statically allocated array of Human objects.

Size attribute representing the size of the array.

Position attribute representing the next free position in the array

Default constructor with no arguments.

Search method that takes a string argument and returns bool. This method returns true when the string passed matches the name of any Humans in the list. In other words, pass the name of a Human, search the list of humans for one with that name. If found, return true. Else return false

Insert method. This accepts a Human object as an argument. If the list of Humans is not full, insert this into the list then increment position. If the list is full, throw an exception.

You do not need to implement destructor or overloaded operators. You may not use anything from the STL, vectors, or linked lists. The search and insert methods must be your own.

Class Source Code

The classes must be defined in a header file with no implementation. Additionally, create an implementation file with all of the implementation code. See the provided Die class example for an example of this format.

Driver

Create a driver to demonstrate all of the features of your People class. The driver is the only class with main().

The driver must prompt the user for a number of Humans that your people object will hold. Next, prompt for how many humans to create. Create a loop to prompt for name, create a Human with that name, then insert into the People object.

Once the People object has been created and populated. Prompt the user for a name, then search the People object for these Humans. Report the results to your user.

Deliverables

Provide the source files for your project. This includes: People.h, People.cpp, Human.h, Human.cpp, and driver.cpp.

Provide screenshots of your driver output. (10% of score) Submit only your own original work before the posted due date on Blackboard. Late or unoriginal work will not be accepted.

Assignment1 ( this is the assignment that we need to use for the assignment 2 above)

Human class

Create a Human class with the following features:

  • Each Human needs a name, an age, and some phrase that they say.
  • Each Human needs appropriate getters and setters for all attributes.
  • For every interaction with this human, increment the age by 1 year.
  • Default constructor with no arguments.
  • Constructor that takes name, age, and phrase arguments.

Human Source Code

The Human class must to be defined in a header file with no implementation. Additionally, create an implementation file with all of the Human implementation code.

See the provided Die class example for an example of this format.

Driver

Create a driver to demonstrate all of the features of your Human class. The driver is the only class with main().

The driver must create a dynamic array of Human Objects of some user defined size. This requires prompting the user for a number of Humans to create.

Be sure to iterate through your array of Humans. Interact with every Human object. Demonstrate ALL features of the Human class.

Deliverables

Provide three source files for your project: Human.h, Human.cpp, and driver.cpp.

Provide screenshots of your driver output. (10% of score)

Submit only your own original work before the posted due date on Blackboard. Late or unoriginal work will not be accepted.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!