Started By
Message

Yet another C# problem

Posted on 3/3/15 at 2:10 pm
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22308 posts
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)

Posted by tom
Baton Rouge
Member since Jun 2007
8320 posts
Posted on 3/3/15 at 2:19 pm to
It's hilarious how they still make people write console applications just to make sure they gain no useful skills in the class.
Posted by Korkstand
Member since Nov 2003
28892 posts
Posted on 3/3/15 at 2:27 pm to
quote:

(note column alignments)
Posted by gmrkr5
NC
Member since Jul 2009
14922 posts
Posted on 3/3/15 at 2:59 pm to
quote:

C#


i found your problem
Posted by MamouTiger65
Baton Rouge, La
Member since Oct 2007
814 posts
Posted on 3/3/15 at 3:04 pm to
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 by aaronb023
TeamBunt CEO
Member since Feb 2005
11774 posts
Posted on 3/3/15 at 3:38 pm to
You using sublime text?
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram