- My Forums
- Tiger Rant
- LSU Recruiting
- SEC Rant
- Saints Talk
- Pelicans Talk
- More Sports Board
- Fantasy Sports
- Golf Board
- Soccer Board
- O-T Lounge
- Tech Board
- Home/Garden Board
- Outdoor Board
- Health/Fitness Board
- Movie/TV Board
- Book Board
- Music Board
- Political Talk
- Money Talk
- Fark Board
- Gaming Board
- Travel Board
- Food/Drink Board
- Ticket Exchange
- TD Help Board
Customize My Forums- View All Forums
- Show Left Links
- Topic Sort Options
- Trending Topics
- Recent Topics
- Active Topics
Started By
Message
Yet another C# problem
Posted on 3/3/15 at 2:10 pm
Posted on 3/3/15 at 2:10 pm
Sorry. Need help again with yet another C# problem. Please help. I've done all I could and just can't get it right.
I can't seem to get loop to work correctly. I also can't figure out how to store the quantities and display them at the end.
Here is the problem.
3. Console app: A store only sells 4 items: Milk (barcode “732”; $4.50 per gallon; 0% sales tax), laundry detergent (barcode “120”; $8 per container; 9.5% sales tax), newspapers (barcode “222”; $1.50 each; 4% state tax) and boxes of cigarettes (barcode “000”; $10 each; 120% sales tax). Develop a program for a point of sale (POS) machine that does the following:
a. Waits for cashier to type in “checkout” or “logout”; if the latter, exit the application; else for checkout go thru following steps:
b. “scans” each item – on one line, enter barcode, a space, and then quantity. For each item:
i. Check if barcode recognized and qty numeric and > 1. If either not met, print an error msg and go back to (b).
ii. Calculate subtotal and tax (applying correct tax for the item), and add to order total.
iii. Add item line to receipt string.
c. Repeat (b) until a blank line is entered, then calculate and print a receipt similar to the following in format (note column alignments):
Milk $ 5.00 x 4 $ 20.00
Laundry Det $ 8.00 x 1 $ 8.00
---------------------------------------------------
Subtotal $ 28.00
Tax $ 2.66
---------------------------------------------------
Total $ 30.66
d. Return to step (a)
I can't seem to get loop to work correctly. I also can't figure out how to store the quantities and display them at the end.
Here is the problem.
3. Console app: A store only sells 4 items: Milk (barcode “732”; $4.50 per gallon; 0% sales tax), laundry detergent (barcode “120”; $8 per container; 9.5% sales tax), newspapers (barcode “222”; $1.50 each; 4% state tax) and boxes of cigarettes (barcode “000”; $10 each; 120% sales tax). Develop a program for a point of sale (POS) machine that does the following:
a. Waits for cashier to type in “checkout” or “logout”; if the latter, exit the application; else for checkout go thru following steps:
b. “scans” each item – on one line, enter barcode, a space, and then quantity. For each item:
i. Check if barcode recognized and qty numeric and > 1. If either not met, print an error msg and go back to (b).
ii. Calculate subtotal and tax (applying correct tax for the item), and add to order total.
iii. Add item line to receipt string.
c. Repeat (b) until a blank line is entered, then calculate and print a receipt similar to the following in format (note column alignments):
Milk $ 5.00 x 4 $ 20.00
Laundry Det $ 8.00 x 1 $ 8.00
---------------------------------------------------
Subtotal $ 28.00
Tax $ 2.66
---------------------------------------------------
Total $ 30.66
d. Return to step (a)
Posted on 3/3/15 at 2:19 pm to Hu_Flung_Pu
It's hilarious how they still make people write console applications just to make sure they gain no useful skills in the class.
Posted on 3/3/15 at 2:27 pm to Hu_Flung_Pu
quote:
(note column alignments)
Posted on 3/3/15 at 2:59 pm to Hu_Flung_Pu
quote:
C#
i found your problem
Posted on 3/3/15 at 3:04 pm to Hu_Flung_Pu
Write out the logic before you start coding. You only check once if they want to logout or checkout. That needs to be part of a loop. You will also need an array to store your receipt values so you can print out at the end.
Posted on 3/3/15 at 3:38 pm to Hu_Flung_Pu
You using sublime text?
Popular
Back to top
Follow TigerDroppings for LSU Football News