Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ The leader of a scout troop has a program that members use to manage cookie sales. Members enter their orders into the program and

C++

The leader of a scout troop has a program that members use to manage cookie sales. Members enter their orders into the program and it generates a file listing each customers name, the number of cookie types ordered, then for each type ordered, the number of boxes and cookie name. The first two records of a sample file are shown below:

Allia Ramez

2

1 Thin Mint

2 Carmel Delite

Samuel Hardash

3

2 Shortbread

1 Lemonade

2 Carmel Delite

Write a program that will process this file, reading the file name from the user, and then creating a linked list with records containing the following information, ordered alphabetically by cookie name.

struct CookieNode { char cookie_name[COOKIE_NAME_SIZE];

int num_boxes;

char customer_name[CUSTOMER_NAME_SIZE];

CookieNode * next;

};

After processing the file, your program should display a menu that allows the user to choose one of the following options:

  1. Print Ordering Summary
  2. Print List
  3. Exit

Each option is explained below:

  1. Print Ordering Summary: Displays a table. Each line contains a cookie name followed by a single number stating the total number of boxes of that cookie type that must be ordered to fill all orders in the list. The cookie names must appear in alphabetical order.
  2. Print List: Displays the linked list as a table with the data for each node on a separate line. Give the cookie name, number of boxes, and customer name for each node.
  3. Exit: Exits the program

Your program must continue to display the menu and process selections as stated above until the user chooses to exit the program.

Write a class named CookieList that contains a linked list of the CookieNode structures given above. Your class should include a constructor and destructor along with methods to insert a node and display the list.

Write a class named CookieFile that contains methods to read the file, print the ordering summary, and print the list. This class will include a CookieList member variable. The methods in this class will invoke the operations in the CookieList class as necessary.

Store your class declarations and member functions in separate files named with the class name and the appropriate extension (.h or .cpp).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions