LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-15-2016, 08:17 PM   #1
tstaszek
LQ Newbie
 
Registered: Mar 2016
Posts: 1

Rep: Reputation: Disabled
Program Help


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.
 
Old 03-15-2016, 10:40 PM   #2
bcwagne
Member
 
Registered: Feb 2008
Distribution: Debian Testing
Posts: 169

Rep: Reputation: 32
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.

Good luck!
 
1 members found this post helpful.
Old 03-16-2016, 02:33 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Above is good advice. Remember that we are happy to help, but no one here will do the assignment for you.
 
Old 03-16-2016, 09:04 AM   #4
kajaljha
LQ Newbie
 
Registered: Mar 2016
Posts: 1

Rep: Reputation: 0
Thanx

thank you for imformation
 
Old 03-16-2016, 07:20 PM   #5
psionl0
Member
 
Registered: Jan 2011
Distribution: slackware_64 14.1
Posts: 722
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
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.

Last edited by psionl0; 03-16-2016 at 07:21 PM.
 
Old 03-17-2016, 07:39 AM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 03-17-2016, 07:43 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Show us your work, thus far.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use web to invoke php program, and the php program call c program bellhuang Linux - Server 10 01-13-2014 06:09 AM
Simple C++ Program: Program Compiles But Won't Run (Segmentation Fault) violagirl23 Programming 3 01-09-2008 12:09 AM
Total recovery: Which program? ghost4linux, YaST2? Best drive imaging program? lagu2653 Linux - Software 1 06-20-2005 01:44 PM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration