Question
Data Abstraction & Problem Solving with C++ (7th Edition) Ch. 8, Programming Problems 2, pg. 264. Santa Claus allegedly keeps lists of those who are
Data Abstraction & Problem Solving with C++ (7th Edition) Ch. 8, Programming Problems 2, pg. 264.
Santa Claus allegedly keeps lists of those who are naughty and those who are nice. On the naughty list are the names of those who will get coal in their stocking. On the nice list are those who will receive gifts.
Each object in this list contains a name(a string) and a list of that person's gifts(an instance of an ADT list). Design an ADT for the objects in the nice list. Specify each ADT operation by stating its purpose, describing its parameters, and writing preconditions, postconditions, and a pseudocode version of its header. Then write a template interface for the ADT that includes javadoc-style comments.
Following are the requirement:
Program must compile and run.
All inputs are strings.
Only do the nice list, not the naughty list.
User will enter names until empty string denoting no more names.
Each name will be followed by one or more gifts.
After names entered display contents of the name list and each gift list.
You can use array list
Don't necessary need to use smart pointer
Following are the example output:
Example run of program
name for nice list: greg
add gifts for greg
gift: legos
gift: cookie
gift:
name for nice list: bob
add gifts for bob
gift: monopoly
gift: candy cane
gift:
name for nice list: alice
add gifts for alice
gift: dress
gift:
name for nice list: tim
add gifts for tim
gift: superman comic
gift: car
gift: pony
gift:
name for nice list:
The list contains
greg legos cookie
bob monopoly candy cane
alice dress
tim superman comic car pony
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started