ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok, so im not sure if this is the correct section to post this particular question because im new, so i apologize if its incorrectly placed. So here goes, im in my last week of linux class and its killing me, im trying my best to get it, but a program my teacher asked us to create is killing me, it goes as follows "Write a program called "register" to work as a cash register system. It should keep getting item prices from the user as long as user wants to enter new values. When user is done, show him the total amount, number of items purchased, highest value and lowest value. If total amount is above 200, apply a $20 discount. Keep asking for payment until it's paid off. If payment is less than balance, take it off the total and show him the remaining balance. When payment is bigger than remaining balance, show user the change amount." if anyone can help at all, i would be beyond thankful.
Look, I hate to do this, but LQ doesn't really DO homework questions. Per the LQ rules:
"Do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and searches) and we'll do our best to help. Keep in mind that your instructor might also be an LQ member."
My suggestion (I've done it hundreds of times in programming class) is to write it all down on paper in plain language FIRST, then move to pseudocode, then try to make it work in whatever language you're using.
There are two basic blocks in this program: "add item purchased" and "deduct payments".
Each time "add item purchased" runs, it is going to (potentially) affect 4 variables: "minimum", "maximum", "total", and "number purchased".
Each time "deduct payments" is run it (potentially) affects 2 variables: "total" and "change".
There may be more variables that you may want to use in your program and both blocks will run in a loop until a terminating condition is encountered. You will also need an "IF total > 200" statement.
What's killing you? Have you written "A" program, for starters? What language are you using? I'm assuming that you've gotten through this course having written at least a program or two. Typically an instructor also builds their students up towards more complex projects. For instance they likely gave you assignments to teach you about input and output, and other assignments to teach you about computing and output result values. Therefore one would expect you to combine the earlier learned concepts and produce this final assignment results.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.