It is time to put together a lot the elements learned so far from the C language and do a “bigger” program.

computer science

Description

Task description

It is time to put together a lot the elements learned so far from the C language and do a “bigger” program. You will have to determine the proper declarations and write functions to achieve the expected output. You will need to write a function outside the main to read a text file containing item names and their price and update arrays declared inside the main from reading the file using pointers parameters in the definition of your “readFile” (ex.) function. Once the file is read, the main function can start doing what it’s meant to: act as a cash register, where the cashier can enter an item name that is matched (strcmp) from the item names of the read file to extract it’s price. If it does not find the item name, cashier has option to “create the item”, by entering its price and updating (appending) the read file and the arrays from main. You then need to write a function to calculate the taxes and the total price of the item and display it on screen. The customer can tell the cashier to add has many items has he wants (we’ll limit this to 100), until he decides to pay. You need to calculate the total price of the “bill”, the money the customer gives, and the change returned. The chapter on basic statistics should be helpful. The cashier can do the operation, for as many customers he wishes (we’ll limit this to a 100), which represents the number of transactions. When the cashier tells the program he does not want to enter a next customer, this part of the program ends, simulating an “end of day” function on a cash register, and it calculates and writes to a text file the number of transactions, the total amount of sales, the total amount of cash received by customers and the total amount of cash returned by the cashier.

 


Related Questions in computer science category