User Output Definitions Shopping Cart Reports Customers may request to see the c
ID: 666977 • Letter: U
Question
User Output Definitions Shopping Cart Reports Customers may request to see the contents of their shopping cart at any time. Upon request, you must write the following information to a text file (TXT). The file name must contain the customer account number (e.g 23738495 TXT) Customer account number A list of food items with associated quantity and price values Total cost of all items in this cart Check out Receipt This is a report is almost identical to the cart report but it also includes a record of coupons applied Current date Customer account number A list of food items with associated quantity and price values A list of coupons each represented by the associated food name and discount price Total cost of all items in this cart at checkout Inventory Controls Reports There are only two types of inventory reports one that shows all food items and one that shows only a selected item Current date A list of food items with associated quantity and price values OR Current date One food item with associated quantity and price value Data Resource Files You must design your own files to hold data that your application needs to run properly. However, you must use only one file for all customer data (including account data, one file for all cart data and one file for all inventory data. Each of these three data files must use random access with binary format. Validation and Error Messages You must use C++ exception handling (try-throw-catch) to check for the follow exceptions. Print an appropriate error message in the console window whenever these exceptions are detected. Food request quantity not available in inventory Insumicient quantity in cart for reinove request Insufficicnt funds in dcbit account at chcckoutExplanation / Answer
#include <stdio.h>
main( )
{
FILE *fp;
char c;
funny = fopen("TENLINES.TXT", "r");
if (fp == NULL)
printf("File doesn't exist ");
else {
do {
c = getc(fp); /* get one character from the file
*/
putchar(c); /* display it on the monitor
*/
} while (c != EOF); /* repeat until EOF (end of file)
*/
}
fclose(fp);
}
Now how to use exceptions as given below:
throw: A program throws an exception when a problem shows up. This is done using a throw keyword.
catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.
try: A try block identifies a block of code for which particular exceptions will be activated. It's followed by one or more catch blocks.
Throwing Exceptions:
Catching Exceptions:
First of all use this code to understand then you can solve problem easily but if still you have any doubt then please revert back me.
Thanks,
Rishu Sharma
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.