Write a class BCheckString that is derived from the STL string class. This new class will have two member functions:

A.A BCheckString(string s) constructor that receives a string object passed by value and passes it on to the base class constructor.

B.A char operator[](int k) function that throws a BoundsException object if k is negative or is greater than or equal to the length of the string. If k is within the bounds of the string, this function will return the character at position k in the string.

You will need to write the definition of the BoundsException class. Test your class with a main function that attempts to access characters that are within and outside the bounds of a suitably initialized BCheckString object.

Suppose that data representing a list of people and places they would like to visit is stored in a file as follows:

3
0 Paul
1 Peter
2 David
0 3 Chicago Boston Memphis
1 1 Boston
2 0

The first number n in the file indicates how many people there are in the list. Here n is 3, so there are three people. Each person in the list is assigned a number in the range 0.. n -1 that is used to identify that person. For each person, the file lists the numerical identifier of the person followed by the number of places the person wants to visit, followed by the name of those places. For example, Boston is the only thing Peter cares to visit, while David wants to visit no places.

Write a program that reads in this type of data from a file and stores it in appropriate STL data structure. For example, you might use vectors well as vectors of vectors, to represent this information. The program allows uses to type in the name of a person whose list of favorite destinations is to be printed out. The program prints an error message if the person is not in the database.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.