954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Not asking for hand outs, just a little help

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
jproducer
Newbie Poster
18 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

Well your while not eof implies that you need to read input inside the loop.
Did you even want a loop here?

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

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.

jproducer
Newbie Poster
18 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

Perhaps your While not eof should be before your get input.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

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"?

jproducer
Newbie Poster
18 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 
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
Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

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.

jproducer
Newbie Poster
18 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You