Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Program in C language If a customer has less than 10 items then they go to the express register, otherwise, they go to the normal

Program in C language

If a customer has less than 10 items then they go to the express register, otherwise, they go to the normal register. If the customer does not have enough money, they will be rejected and their items will be removed. Your program will read in customers from a file input.txt, parse them as structs then place them into your queue for processing by the register or express register. Your program should maintain a log file that records which customer went to the register.

When your program is complete, write this log to a file output.txt in the same directory as your .c file.

You must use a queue to use for the customers queue. You can use any implementation (array, linked list, circular, etc) that you wish so long as it works and is a

queue.

You must use structs Customer and Grocery_Item to store the customer data, and grocery items respectively.

You must use a linked list with value Grocery_Item in the Customer struct. You can use any implementation (doubly-linked, header, etc) that you wish

so long as it works and is a linked list.

Data Structure needs to use:

struct Customer

struct Grocery_Item

linked list Grocery_Item

A queue

Be able to read in a txt file

Be able to write out to a txt file

Ex Input:

Input.txt

{Karen, 15.00, [{Bananas, 5.00, 1}, {Cookies, 3.50, 1}, {Eggs, 1.25, 2}]}

{Bill, 50.00, [{Water, 3.99, 3}, {Hamburger Meat, 8.50, 2}, {Eggs, 1.25, 6}]}

{Jimmy, 5.00, [{Wine, 16.00, 1}]}// This is in the txt file that the program will read into to use as data.

Ex Output:

Output.txt

Karen paid $11.00 for 1 Bananas, 1 Cookies, 1 Eggs at the express register

Bill paid $36.47 for 3 Water, 2 Hamburger, 6 Eggs at the regular register

Jimmy was rejected at the express register// This is what will be in the output txt file after the program is compiled and executed.

The only libraries (.h file) you are allowed to use are stdlib.h, and stdio.h.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Intermediate Accounting

Authors: kieso, weygandt and warfield.

14th Edition

9780470587232, 470587288, 470587237, 978-0470587287

Students also viewed these Finance questions