Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that processes records of items purchased. Assume the items are being purchased by one person. Create a class definition for item

Write a C++ program that processes records of items purchased. Assume the items are being purchased by one person.

Create a class definition for item records with the following fields: id, name, quantity, regular price, price paid, and total for item.

Dynamically allocate an array and read records from a file. You will read all fields except the price paid and total. See below.

Calculate price paid for items. Customers get a 10% discount off regular price of item if they purchase 10 or more of the item.

Calculate the total (quantity times price paid) for each record.

Sort the records in the array by the items name using the generic sort function in the file sort.h.

Write the updated records out to a new file (orderout.txt). Include all field data.

Use the following test data (5 Records in the file order.txt ) to test your program:

5 0-8053-7442-6 Problem Solving with C++ 1 45.50 7751158146 Looney Tunes Diskettes 12 8.50 88869809780 HP Laser Printer Paper 3 10.99 2429412454 No. 2 Pencil 24 0.10 4895469286 Note Pad 5 0.89 
Turn in copies of your program and the output file from test run.

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions