الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ممكن تساعدوني

بدأه هاوي العماني في 23 سبتمبر 2008 · 1 رد · 560 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

عندي هتامشنلة..أتمنى تحلوها لي

Write, run, and test a C++ program to simulate the operation of a small store casher system. Your program should first build a data structure to contain information on all the products available in the store. Then the program should print the cash register receipt for each customer.

<H2 style="MARGIN: 24pt 0in 12pt 40pt">Input</H2>The input for this program has two sources: the inventory information is input from a text file, and the customer transactions are input from the keyboard.

1. The information about each product carried by the store is listed on a single line in the inventory file "Inv.dat", in the following format:

<product number> <description> <price> <tax>

Where:

· <product number> is a five-digit positive (nonzero) integer,

· <description> is a string of at most 12 characters with no embedded blanks,

· <price> is a real number, and <tax> is a character ('T' if the product is taxable; 'N' if it is not taxable).

The data in the inventory file is ordered from smallest to largest product number.

2. The customer transactions are input from the keyboard, in the following format:

<product number> <times>

Where:

<product number> is as described above, and

<times> is an integer in the range 1 to 100, indicating the quantity of this product desired.

Note: A zero input for <product number> indicates the end of the customer's order.

<H2 style="MARGIN: 24pt 0in 12pt 40pt">Output</H2>The program outputs should be written to a text file called "Receipts.txt", which is printed:

1. The inventory information is echo printed to the output file.

2. The cash register receipt for each customer is written to the output file.

3. The receipts should be nicely formatted, with the product description (not the product number), number of items, item price, and total price for each product printed on a single line.

4. At the end of each customer's order, the subtotal for all items, amount of tax on taxable items, and total bill should be printed, clearly labeled.

5. The tax rate is 7.5% for taxable items.

<H2 style="MARGIN: 24pt 0in 12pt 40pt">Processing</H2>The program first reads in all of the inventory information from file "Inv.dat", echo printing the information to the output file. The program then prompts the cashier to begin inputting the order for the first customer. This customer's order is processed, and the receipt is printed to the output file.

After each customer's order is processed, the program should ask the cashier if another customer is to be processed. If the answer is 'Y', the program sets up to process the next customer; if the answer is 'N', the program terminates with a friendly message.

<H2 style="MARGIN: 24pt 0in 12pt 40pt">Error Checking</H2>The following input errors are possible and should be handled by your program:

1. Duplicate <product number> in inventory file. Write an error message to the output file and skip the second entry.

2. <Product number> not in inventory file. Write an error message on the receipt, ignore that product number, and continue with the next item.

3. <Times> not in the specified range. Write an error message to the output file, ignore that line, and continue with the next item.

<H2 style="MARGIN: 24pt 0in 12pt 40pt">Example:</H2> From File "Invent.dat":

11012 gallon-milk 1.99 N

11014 butter 2.59 N

11110 pie-shells 0.99 N

20115 laundry-soap 3.60 T

30005 homestyle-br 0.99 N

From keyboard (one customer):

11110 2

40012 3

20115 1

0

To "Receipts.txt" file:

------------------------------------------------------

SEP 10, 1998 6:00 pm (* date and time optional *)

Customer 1

pie-shells 2 @ 0.99 1.98

*** item 40012 not in inventory ***

laundry-soap 1 @ 3.60 3.60 TX

Subtotal 5.58

Tax 0.27

Total 5.85

<H2 style="MARGIN: 24pt 0in 12pt 40pt"> </H2><H2 style="MARGIN: 24pt 0in 12pt 40pt">Data Structures</H2>The inventory information can be stored in a list of product records. Assume that the maximum number of products is 50, for purposes of writing this program. As the data in the inventory file is ordered from smallest to largest product number, it is very simple to insert the product records into this data structure in order. You can use either a sequential or binary search to locate a product number in the inventory.

You should specify this data structure as an ADT, as described in the chapter; define and implement a set of operations to encapsulate it.

#2

عندك هتامشنلة ؟ :)

هل قرأت هذا البند في قواعد طرح الأسئلة المشاركات؟

اقتباس
ممنوعات : تعرض المشاركة للالغاء الفوري

1. ممنوع منعاً باتاً طلب حلول واجبات/مشاريع أعمال سنة/تمارين او تنفيذ بحوث نيابة عنك، فما طلبه أستاذك في المؤسسة العلمية التي تدرس فيها، طلب منك أداءه لتقييمك أنت وليس لتقييمنا نحن.

يمكننا أن نساعدك، ولكن بعد أن ترينا محاولاتك في الحل والبحث عن حلول والمشاكل التي واجهتك.

مواضيع مشابهة