# Foundations of Computer Science Assignment #3

\$30.00

Category:
Rate this product

COP3014-Foundations of Computer Science Assignment #3
In this assignment you will implement a program called “ebay_purchase_recs.cpp”
to process customer purchase orders (orders) on Ebay. The purchase orderswill be
stored in variables. There are nine fields,which are as follows: 1) a ten-digit customer
cell phone number (string, no dashes),2) the item number (string), 3) the number of
items (quantity) in the purchase order (integer), 4) the cost (price) of one item (
double), 5) processing plant number (integer), 6) the tax rate on the order (double),7)
the net cost ofthe purchase order (double),8) the purchase order tax (double) and 9)
the total cost of the purchase order (double).
will call (invoke) each function until the end of the datafile has been reached.
Following are the descriptions of the functionality of each function:
1. The void function “input” will have six parameters: the input file
stream called “in”, the cell_number (customer cell phone number),
the item_number ( item identification number), the quantity (
number of items in purchase order), the price (cost of one item)
and the processing_plant(processing plant identification number.
The function will read the cell_number, item_number , quantity,
price and processing_plant fromthe datafile.
2. The function “process” will calculate the order tax rate (tax_rate), net
cost of an order (net_cost), the tax on an order (order_tax) and the total
cost of an order (total_cost) using the quantity, cost of an item (price),
and processing plant identification number (processing_plant) for a
a. The tax rate on an order (tax_rate) issimply based on the
processing plant identification number (processing_plant) which
is where the order was processed (0<= processing_plant<= 100
then tax_rate = 6%; 101<= processing_plant <=200 then
tax_rate = 7%; 201<= processing_plant<=250 then tax_rate =
8%; 251<= processing_plant <=400 then tax_rate = 9%;
processing_plant >400 then tax_rate =12%) .
b. The tax on an order (order_tax) is calculated by the following
formula:
order_tax = (quantity) x (price) x [(tax_rate) / 100].
c. The net cost of an order (net_cost), which does not include tax,
is calculated by the following formula:
2
net_cost = (quantity) x price .
d. The total cost of an order (rounded to the nearest hundredth)
is calculated by the following formula:
total_cost = net_cost + order_tax.
All tax and cost calculations should be rounded to the nearest
hundredths.
3. The function “output”will print every variable to the screen. The variables
should be printed in the following order: 1) cellphone number, 2)
item_number, 3) quantity, 4)price, 5)processing_plant, 6) tax rate, 7) order
tax, 8) net cost, and 9)total cost of order.
See sections below called“Input Sream” and “Format of Output for
Input Data File (input filename is “ebay_purchase_data.txt”)”.
You may implement more functions if you find it necessary. Please startthe
assignment ASAP, and ask questions to make sure you understand what you
must do.It is always a good to start with the skeleton program I provide.
Remember to follow allstyle rules and to include all necessary documentation
(consistent, indentation, proper variable names, pre/post condition, program
(ebay_purchase_data.txt) should be in the same directory as your program
source file (ebay_purchase_recs.cpp).
Output Formatfor the Function “output”:
Consider the following sample output table when designing and
implementing the function “output”.
(The output is in the following order: cell phone number, item number, quantity,
price, process plant, tax rate, order tax, net cost, total order cost)
9546321555 452-XLY 2 70.82 503 0.12 17 141.64 158.64
9546321555 742-6Z3 300 10.14 47 0.06 182.52 3042.00 3224.52
Input Stream:
In the assignment you will declare one ifstream to bind your input to the file
“ebay_purchase_data.txt” Whenever a program performs file i/o you must
For source file, “ebay_purchase_recs.cpp”:
source file.
3
file.
source file.
Format of the input data file (input filename is “ebay_purchase_data.txt”):
Do not include column titles (cell phone number, item, quantity, price, processing plant)
9546321555 452‐XLY 2 70.82 503
9546321555 742‐6Z3 300 10.14 47
5612971340 924‐YUT 8 23.00 51
3051234567 9L3‐11T 47 50.12 200
7542346622 453‐TTT 92 25.25 110
3054432762 213‐ABC 15 105.02 111
9544321011 321‐XMZ 112 32.41 92
8776219988 444‐SSS 100 12.12 86
9042224556 290‐P23 297 9.62 500
7877176590 23Z‐00Q 32 9.62 201
5617278899 893‐42T 642 0.81 72
9546321555 008‐LL5 90 45.80 18
5612971340 452‐XLY 42 99.99 503
3051234567 742‐6Z3 14 10.14 47
7542346622 742‐6Z4 13 66.48 3
3054432762 742‐6Z5 209 0.77 2
9544321011 742‐6Z6 108 1.17 1
8776219988 213‐ABC 67 105.02 111
9042224556 321‐XMZ 500 32.41 92
7877176590 444‐SSS 43 12.12 86
5617278899 290‐P23 16 9.92 500
8776219988 23Z‐00Q 82 9.62 201
9042224556 23Z‐00Q 87 9.62 201
7877176590 23Z‐00Q 445 9.62 201
4

Scroll to Top