- 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:58 pm to tom
quote:I think you're drawing a distinction where there isn't much of one. Classes teach the basics of programming (make something that works) first without burdening students with too much at once. Why bother with GUI shite if you don't even know how to write a loop?
It's hilarious how they still make people write console applications just to make sure they gain no useful skills in the class.
Also, I think you discount the usefulness of console apps. Not only are they still extremely useful and more powerful than any GUI app in the Linux world, but there's not a huge difference between an app that gets parameters from the console and one that get parameters over the network. It wouldn't take much to convert OP's app into a server that could handle requests from any front end, whether it's a web app, or a desktop GUI, or a mobile app.
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:08 pm to Korkstand
While most of that is true, I'll bet the average student in the class spends more time formatting all that console nonsense like the problem requires than they do in the actual code.
Posted on 3/3/15 at 3:21 pm to tom
I know what you're saying, but formatting text is just a problem to be solved like any other.
I'm not trying to pick a fight, I just didn't want OP thinking he was learning useless shite.
I'm not trying to pick a fight, I just didn't want OP thinking he was learning useless shite.
Posted on 3/3/15 at 3:23 pm to tom
quote:
While most of that is true, I'll bet the average student in the class spends more time formatting all that console nonsense like the problem requires than they do in the actual code.
Seems like creating a decent presentation layer would be far more tedious and less relevant to someone learning basic logic and data structures.
Posted on 3/3/15 at 3:45 pm to aaronb023
quote:Probably VS
You using sublime text?
Posted on 3/3/15 at 5:18 pm to Korkstand
I figured it out when I submitted it
Posted on 3/3/15 at 7:34 pm to tom
quote:
While most of that is true, I'll bet the average student in the class spends more time formatting all that console nonsense like the problem requires than they do in the actual code.
It's thinking like this that leads to a bunch of sloppy arse programmers writing sloppy arse code.
Posted on 3/3/15 at 8:51 pm to Casty McBoozer
oh goodness. fight! I'm going for Korkstand since he is one of my bosses on castle clash. just saying.
Posted on 3/3/15 at 8:53 pm to aaronb023
quote:
You using sublime text?
VS 2013
Popular
Back to top
Follow TigerDroppings for LSU Football News