首页 > > 详细

ASSIGNMENT 1 Build a shopping cart

 ASSIGNMENT 1 

Due Friday 10/4/20 18:00* 
*Late submissions will incur penalties
Build a shopping cart. 
Your store must have minimum 12 items 
The user chooses an item by pressing a corresponding key then ‘Enter’ 
If the user chooses 2 keys and presses enter, only his last choice should be logged 
If the user presses Enter twice, the order is to complete. 
All items must be saved in the order they were entered 
An invoice/receipt should be printed 
The items should then be sorted into the same order as the shopping cart. 
Be sure to use a function taking pointers to swap the data for sorting. 
If an item was ordered twice, only 1 row should be printed, with a QTY field and a 
calculated price. 
Example output is bold ( red is user entered and should not be printed by the program ) 
Your output MUST look identical to the next page (if the same keys ( in red ) are pressed) 
only items and prices may differ. 
Dollar values MUST line up on the “.”, “$” symbols must also align 
Please make it interesting by changing the items and prices in your shop to reflect your 
own personality. 
WELCOME TO MY SHOPPING CART 
Please select from the following 
a) Hat $ 4.99 
b) Bicycle $300.00 
c) iPod $599.00 
d) Sneakers $135.00 
e) Sunglasses $ 89.90 
f) Socks $ 2.99 
g) Shirt $ 25.00 
h) Pants $ 30.00 
i) Tie $ 24.99 
j) Wallet $ 19.95 
Choose an item (press enter to select an item, or finish your order) 
You have chosen: Hat 
You have chosen: Shirt 
agf 
You have chosen: Socks 
You have chosen: Socks 
You have chosen: Tie 
eaf 
You have chosen: Socks 
Your order is as follows: 
Item QTY Cost Total 
Hat 1 $ 4.99 $ 4.99 
Socks 3 $ 2.99 $ 8.97 
Shirt 1 $25.00 $25.00 
Tie 1 $24.99 $24.99 
Total: $63.95 
Is this correct? Proceed to Checkout (Y) or Cancel (N)? 
If you enter “a ENTER g ENTER agf ENTER f ENTER i ENTER eaf ENTER ENTER”
 And your output does not look like the above,
 you will NOT be able to receive full marks To Receive full marks you will need to 
- Use appropriate tabbing 
- Have comments explaining what is going on 
- Use a structure - Use an enumerated type - Use an array - Use a sort routine
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!