Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I've write C++ program but the output shows nothing Problem 70 Marks Dynamic Restaurant is a new restaurant operating in Skudai, Johor. The restaurant offers

image text in transcribedimage text in transcribedimage text in transcribed

I've write C++ program but the output shows nothing

image text in transcribedimage text in transcribedimage text in transcribed

Problem 70 Marks Dynamic Restaurant is a new restaurant operating in Skudai, Johor. The restaurant offers three main menus that are Seasonal Fruit Box, Grilled Peri Peri Chicken with Bean Salad, and Mongolian Stir Fried Beef with Baby Bok Choy and Fragrant Rice. Each week the sales manager should provide a weekly sales report. However, he faced difficulties with an increasing number of sales each day. Therefore, write a complete C + program that can assist the sales manager to provide a weekly sales report for Dynamic Restaurant. Table 1 below shows the three main menus and the respective code of the mem. The menu's code is a four-digit integer mimber, where the last two digits represent the price of the menu. For example, the menu's code of 3314 means that the price of the menu is RM14.00. Notes: You may use the modulus operator or the selection instructions to get the price of the menu from its code Table 1: List of menus Menu Code Seasonal Fruit Box 3314 Grilled Peri Peri Chicken with Bean Salad 1118 Mongolian Beef with Stir Fried Baby Bok Choy and Fragrant Rice 2220 In order to boost the sales, the restaurant offers 5% of discounts from the gross amount for each order with the quantity more than or equal to 15. The customers also need to pay 6% of additional charges for the Good and Services Tax (GST) for all the memus except the memi with the code of 3314. The GST is calculated based on the amount after deducting the discount The input of the program should be read from a file. The file contains a list of sales, in which each sale (1.e., each line) is represented by the code and the quantity of the ordered menu. Examples of the input files are shown in Figure 1(a) and 2(a). Notes: The input data are read from the file until the menu's code equals to the value of zero. The output of the program should be displayed into another file. Examples of the output files can be seen in Figure 1(b) and 2(b). The output file should include the following information: a) Sales Details: the list of sales, where each sale consists of the menu's code quantity of the ordered memu, price of the menu gross amount of charges to the customer (1.e. the amount before the GST and discount are included) discount rate given to the customer, GST rate and nett amount paid by the customer (i.e., inclusive of GST and discount). b) The sales statistics, which shows the total quantity of orders for each menu. c) The weekly total sales (1.e., inclusive of the discounts and GSTS). The assessment criteria are as shown in Table 2. 1118 5 2220 8 3314 20 3314 12 1118 30 33149 1110 10 (a) Input file named "input1.txt" Dynamic Restaurant's Weekly Sales Report :: SALES DETAILS: ES Code Quantity Price (RM) Amount (RM) Discount() GST Total (RM) 1118 2220 3314 3314 111 3314 1118 5 B 20 12 30 9 10 18.00 20.00 14.00 14.00 18.00 14.00 18.00 90.00 160.00 280.00 168.00 540.00 126.00 180.00 0.00 0.00 5.00 0.00 5.00 0.00 0.00 6.00 6.00 0.00 0.00 95.40 169.60 266.00 168.00 543.78 126.00 190.00 0.00 6.00 EE ::SALES STATISTICS:: ====== Code Total Quantity 1118 2220 3314 @ Total Sales = RM 1559.58 (b) The output file for the input file "imput1.txt" Figure 1: First example run 4 3314 12 1118 5 3314 20 3314 9 1118 10 2220 4 1118 7 3314 16 2220 10 2220 13 1110 10 3314 14 3314 8 1118 9 (a) Input file named "input2.txt" Dynamic Restaurant's Weekly Sales Report :: SALES DETAILS:: Code Quantity Price (RM) Amount (RM) Discount () GST Total (RM) 12 5 20 10 3314 1118 3314 3314 1118 2220 1110 3314 2220 220 111 3314 3314 1118 7 16 18 13 10 14 14.00 18.00 14.00 14.00 16.00 20.00 18.00 14.00 20.00 20.00 18.00 14.00 14.00 18.00 168.00 90.00 280.00 126.00 180.00 80.00 126.00 224.00 360.00 260.00 180.00 196.00 112.00 162.00 0.00 0.00 0.00 6.00 5.00 0.00 0.00 0.00 0.00 6.00 0.00 6.00 0.00 6.00 5.00 0.00 5.00 6.00 0.00 6.00 0.00 6.00 0.00 0.00 0.00 0.00 0.00 6.00 168.00 95.40 266.00 126.00 190.80 84.80 133.56 212.80 362.52 275.60 190.80 196.00 112.00 171.72 :: SALES STATISTICS:: Code Total Quantity 1118 2220 3314 41 35 79 Total Sales = RM 2586.00 () The output file for the input file "input2.txt" Figure 2: Second example run Program - incomplete.cpp SimpleProgram-complete.cppsetw.cpp #include 2 #include #include 4 using namespace std; int main() ifstream inp; ofstream out; int code, qty; double price, grossAmount, nettAmount; double gst, gstAmount; double discount, discountAmount; double totalSales = 0; int qty1 = e, qty2=e, qty3=; inp.open("inputi.txt"); out.open("input2.txt"); 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 out > code >> aty; //read code and aty from input file (start) 35 36 while (code != @) 37 38 switch (code) { 39 case 1118: 40 price = 18; 41 gst = 6; 42 qty1 += qty; 43 break; 44 45 case 2220: 46 price = 20; 47 gst = 6; 48 qty2 += qty; 49 break; 50 51 case 3314: 52 price 14; 53 gst = 0; 54 qty3 += qty; 55 break; 56 } // switch 57 58 if (aty>=15) discount = 5; 59 else discount = 0; grossAmount = price * qty; 61 discountAmount = grossAmount * discount * 0.01; gstAmount = (grossAmount - discountAmount) * gst * 0.01; 63 nettAmount = grossAmount - discountAmount + gstAmount; 64 totalSales += nett Amount; 65 68 62 Program - incomplete.cpp SimpleProgram-complete.cppsetw.cpp 64 totalSales += nettAmount; 65 66 out >code >> qty; //read code and aty from input file ( next until while terminate) 75 } //while 76 77 out

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

How is return on assets related to investing decisions?

Answered: 1 week ago