Hello,I need someone that can built this program for me. I am attaching all the documents necessary. Thank you.
products.txt
program_5_1_.pdf
Unformatted Attachment Preview
SHIRT
KC Royals shirt
M
3
14.99
SUPPLIES
Envelopes
100
5
9.99
SHIRT
I <3 CS! shirt
2XL
3
14.99
SUPPLIES
Staples
5000
12
4.99
Assignment 5
Due: April 8
O
Assignment learning objectives: You are supposed to correctly define and write neat code that utilizes the
concepts of virtual functions and polymorphism.
I.
The assignment problem:
After developing the great application for Swinney recreation center (assignment 4), the UMKCs Bookstore
wants you to build a store application for them. The application main goal is to keep track of the products
purchased and print a receipt at the end. As you know, the Bookstore sells different types of products.
Nevertheless, we assume that our Bookstore sells T-shirts and office supplies only (to make it simpler).
II.
The application input:
The input to your application is a file, called products.txt. A sample file is given to you. This will contain all of
the data needed to read in products bought.
The first data item is the product type. This will be SHIRT or SUPPLIES. Based on the type, your
application should have data of different formats:
? SHIRT: The next full line of the file is the description. This could be multiple words. The next line
contains the size (which will be S through 3XL). The next item is the quantity purchased, then the
price per item without the dollar sign ($).
? SUPPLIES: The next full line of the file is the description. This could be multiple words. The next line
contains the number of items inside of each set. After that is the quantity purchased, then the price per item.
III.
The application output (you can skip to section IV then read this section):
The final output of your application should be a file called receipt.txt. This file will look similar to the
following:
Assignment 5
Due: April 8
O
The store info at the top should consist of one line of 40 *s, one line of one *, spaces, the stores name, spaces,
then one *. The final line is another string of 40 *s.
After a blank line, there should be a header that contains the word Qty, a space, Description, 17 spaces,
then Total. The line under it should have 3 dashes, a space, 27 dashes, a space, and then 8 dashes.
After this should be one product per line:
The quantity should be printed right-aligned in a width of 3 spaces.
The description should be in a set in a width of 28 spaces:
SHIRT: the size, a space, then the description
OFFICESUPPLIES: the description, a space, then a (, the count, a space, the word count, then )
The price should be printed with a $, then a width of 7 spaces. The price should always print out with two
decimal places and have the decimal point also.
There should be another blank line after all products, then print out Grand total: with the total price.
The next line should print Items sold: with the number left-aligned with the price.
The final line should be separated by a blank space and the happy message * Thank you for shopping at
our store! *.
IV.
Application Classes
Your application must include four classes: Products, Shirt, OfficeSupplies, and Register. Following is a
description of each of the classes.
? Product:
Product class is a generic product. The class will be abstract, and thus cannot be instantiated. The product class
must include the following:
Variables to store the price (double), quantity (integer), and description (string)
A default constructor and a constructor that accepts price and quantity
Setter functions to set the classs description, price, and quantity
A pure virtual function, called print, that takes in a reference to an ostream and prints out one receipt line
for this product. (More in the child elements)
A virtual function, called calculateTotal, that will print out the total of how much the product will cost. For
a generic product, its just the quantity times the price.
Assignment 5
Due: April 8
O
? Shirt
The Shirt class is derived from the Product class. In addition to the inherited variables, Shirt class has a variable
to store the shirts size, called size. T-shirts come in various sizes, i. e., S 3XL. The price is the same for all
shirts, but the 2XL and 3XL shirts costs a dollar more. The Shirt class must include the following:
A default constructor
A function to set the size
An overridden print function to print out how a Shirt item looks on a receipt. This also takes in a
referenced ostream
An overridden calculateTotal function to modify how each shirts price is calculated. This is still price
times quantity, but if its 2XL or 3XL add a dollar to the cost.
? OfficeSupplies
The OfficeSupplies class is inherited from Product class. As you know, office supplies are often sold in sets. For
example, 50-pack envelopes, 5-pack of pens, and 500-sheet reams of paper. You class must reflect this. In
particular, your OfficeSupplies class must include the following:
?
A variable to store the count of how many items of a certain product exist (e.g.: 5-pack of pens)
?
A function to set the count
?
An overridden print function to print out how a set of OfficeSupplies will print out. This also takes in a
referenced ostream
?
Since a 50-pack box still counts as one item, the cost is still quantity times price, and doesnt require
redefining the calculateTotal function.
? Register
All the magic happens here. Once the register knows everything that has been purchased, it can print out a
receipt for the customer. Each customer can purchase 50 products at most. The Register class will need:
A default constructor
An array of pointers to Products (more below). This can be a regular array.
A variable to keep track of how many Products are stored in that array, you can call it numProducts
A void function addProduct that will take in a pointer to a Product and add it to the array
A void function printReceipt that will take in a reference to an ostream and print out the entire contents of
the receipt to the output stream (more later).
To store polymorphic objects correctly, the register will need an array of pointers of Products. When you read in
the data from the file, you will create a new type of Product based on what is read in. The pointer to that object
will be passed into addProduct, and add the pointer to the array. After its done, the array will point to all of the
different types as appropriate.
Assignment 5
Due: April 8
O
To print out all of the objects correctly, they all have a required virtual print function. This function can be
called on any Product type of object. The printReceipt function of this class can just simply loop through the
array, and then call the print function on each element of the array. The appropriate print function will be called
on whatever type is in that array position. (For example, if Product[0] is a Shirt, it will call Shirts print
function.)
V.
Other information
The output file should match EXACTLY.
Since descriptions can have multiple words, but exists only on one line, you can use getline() on it. You may
also find that, even though Product types are only one word, you may wish to use getline() also to reduce
issues with new line characters not getting read in as often as needed.
Write your classes in separate .h and .cpp files. You should turn in 9 files when its done.
If you use inheritance right, you wont be copying much information from object to object, which should
increase development time. Write Product first, then the others will be faster to implement.
Remember:
?
Make sure you clearly understand the program and its requirements
?
Write a neat easy-to-follow code and organize it
?
Zip your project and upload it to blackboard no later than midnight on April 8.
~BestOfLuck()
...
Purchase answer to see full
attachment
Why Work with Us
Top Quality and Well-Researched Papers
We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.
Professional and Experienced Academic Writers
We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.
Free Unlimited Revisions
If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.
Prompt Delivery and 100% Money-Back-Guarantee
All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.
Original & Confidential
We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.
24/7 Customer Support
Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
Our Services
No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.
Essays
No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.
Admissions
Admission Essays & Business Writing Help
An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.
Reviews
Editing Support
Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.
Reviews
Revision Support
If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.