Create a People class with the following features: Each People object has a statically allocated array of Human objects. Size attribute representing the maximum 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 a Human object. This method returns the first Human object with a name matching the string argument. In other words, pass the name of a Human as a string, search the list of humans for one with that name. If found, return this human. Else throw an exception. 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. This must use an unsorted, fixed size array of your own, original implementation. Driver

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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.
 
Create a People class with the following features:
  • Each People object has a statically allocated array of Human objects.
  • Size attribute representing the maximum 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 a Human object. This method returns the first Human object with a name matching the string argument. In other words, pass the name of a Human as a string, search the list of humans for one with that name. If found, return this human. Else throw an exception.
  • 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.
This must use an unsorted, fixed size array of your own, original implementation.

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 create a single People object.
 
The driver must prompt the user for a number of Humans to create. Using a loop, prompt for name, age, etc. Then create a Human with these features. Then insert this Human into the People object. Continue until the requested number of humans are inserted 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.
 
The driver must handle exceptions when searching for Human objects not found or when attempting to insert into a full list.
 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education