Not asking for hand outs, just a little help

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Sep 2008
Posts: 18
Reputation: jproducer is an unknown quantity at this point 
Solved Threads: 0
jproducer's Avatar
jproducer jproducer is offline Offline
Newbie Poster

Not asking for hand outs, just a little help

 
0
  #1
Sep 17th, 2008
Okay, so like many others i have an issue. I have written a pseudocode that is supposed to represent the issue below.

#1 Write pseudocode for a program that calculates the service charge a customer owees for writing a bad check. Okay, i got everything right except my teacher turned back to me saying that she wants to give me credit, but I am missing another "get" or this will end up in infinite loop. I am confused, I printed out output and put a stop. I am definitely missing something and have gotten 100% in class so far.

I will never post anything I haven't worked on, and just hope for a little extra push in the right direction from some individuals who know the answer. TIA

Here is my code

Start
Get input 
      currYY
      curmm
      curdd
      chkYY
      chkmm
      chkdd
      chkAmount
             While not eof
                       chkAmount1 = 20 + chckAmount * .02
                       chkAmount2 = 12*(currYY – chkYY) + (curmm – chkmm) *5  
                       chkAmount1 + chckAmount2 = chkFee
              print calculatedAnswer chkFee      
              End While
Stop
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Not asking for hand outs, just a little help

 
0
  #2
Sep 18th, 2008
Well your while not eof implies that you need to read input inside the loop.
Did you even want a loop here?
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 18
Reputation: jproducer is an unknown quantity at this point 
Solved Threads: 0
jproducer's Avatar
jproducer jproducer is offline Offline
Newbie Poster

Re: Not asking for hand outs, just a little help

 
0
  #3
Sep 18th, 2008
I suppose I should post the assignment so I can clear that up. Basically the check should keep incurring charges monthly on the 1st until check is paid. Hence the reason for my get while. I believe this seems strange that both gets are during the while, but for some reason my teacher said this was fine, I am just missing a get. I know I'm missing something here.

Here is the actual question

Design a pseudocode for a program that calculates the service charge a customer owes for writing a bad check. Program accepts customers name, the date the check was written, the current date, and the amount of the check in dollars and cents. The program continues until an eof value is encountered. The service charge is $20 plus 2% of the amount of the check, plus $5 for every month that has passed since the check was written. A check is one month late as soon as a new month starts - so a bad check written on September 30 is one month overdue on October 1st.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Not asking for hand outs, just a little help

 
0
  #4
Sep 18th, 2008
Perhaps your While not eof should be before your get input.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 18
Reputation: jproducer is an unknown quantity at this point 
Solved Threads: 0
jproducer's Avatar
jproducer jproducer is offline Offline
Newbie Poster

Re: Not asking for hand outs, just a little help

 
0
  #5
Sep 18th, 2008
Well, here is what my teacher wrote.

There should be another GET following the print. If it is not there, you will be in an indefinite loop. You read the first record prior to the WHILE. The first statements process the record you read first. After that happens, which is after the print, you need to get the next record to process. Otherwise, you will just process the first record again.

If that does not make sense, let me know. I am sending this back so that you can get the second Get in.
I guess my issue is...What are you "getting"?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,909
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 303
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is online now Online
Cenosillicaphobiac

Re: Not asking for hand outs, just a little help

 
0
  #6
Sep 22nd, 2008
Originally Posted by jproducer View Post

I guess my issue is...What are you "getting"?

Something from the file

The teacher means that you'll have to read something from the file in the while !eof loop.

So something like :
While not eof
    read stuff from file
    do stuff
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 18
Reputation: jproducer is an unknown quantity at this point 
Solved Threads: 0
jproducer's Avatar
jproducer jproducer is offline Offline
Newbie Poster

Re: Not asking for hand outs, just a little help

 
0
  #7
Sep 22nd, 2008
Thank you very much, I think i am getting it. I'll post the response. Thanks to all of you for making me figure this out. That's what I needed.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC