Question: Create a Package class. A Package has the following variables: string name string address string city string state string zipcode string phone number double weight

Create a Package class. A Package has the following variables:
string name
string address
string city
string state
string zipcode
string phone number
double weight
The Package class has getters and setters for each variable, an argument constructor that takes in all of the information for a package and overloaded operators ==,< and <<.
Package(string name, string address, string city, string state, string zip code, string phone, double weight);
friend bool operator ==(const Package& p1, const Package& p2);
The == operator returns true if the name, address, city, state, and zip code match and false otherwise. Please note that the weight is ignored in this operator. This is so that we can search for Packages sent to the same person at the same address.
friend bool operator <(const Package& p1, const Package& p2);
The < operator returns true if name in Package p1 is less than name in Package p2
friend ostream& operator <<(ostream& out, const Package& p);
The output operator displays all of the package information with weight in lbs.
Driver File
Create a driver file where you store 5 packages into a set or multiset (you get to decide which is the best choice for this). When making your choice, consider whether there can be two packages with the same name and address.
How to define a set or multiset of Packagedata type?
set pkgs;
or
multiset pkgs;
The packages have the following information and should be inserted into the set or multiset that you created:
Maria Hernandez
7780 William St.
Salinas
California
93902
831-345-2321
0.23 lbs
Jacobo Zuniga
1134 John St.
Salinas
California
93901
831-875-0101
0.3 lbs
Mariana Alcantar
5780 Main St.
Salinas
California
93901
831-445-2001
0.13 lbs
John Williamson
3201 Third St.
Salinas
California
93902
831-223-3443
0.5 lbs
Maria Hernandez
7780 William St.
Salinas
California
93902
831-345-2321
0.05 lbs
Next, you will ask the user for a Package they want to search for (you will need ask for the Package's name, address, city, state, and zip code) and set the weight to 0. Search through the set or multiset for a Package that matches the entered Package information. Display all packages that match (you might have more than one if there are Package's with the same name and address information. Display the package information (this should include the weight of the package). Allow the user to repeat the search with new Package information until the user no longer wishes to perform a search.
Sample run:

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 Programming Questions!