View Full Version : algorithm help ....need pointers on how to
daraptor
12-31-2007, 07:01 AM
hey guyz...am new to programmin
i have an assignment due on jan 3rd...its jss an algorithm...i hope someone can help me figure out something by pointin an example
the algorithm is...
In English, provide a detailed algorithm to make a phone call (make sure you handle various situations such as busy signal, no answer, etc.).
thanx to anyone who helps.
brad211987
12-31-2007, 03:55 PM
Pretend you are making a phone call, and write down every step you take. Include possible outcomes such as busy signal etc..
For example if you were writing and mailing a letter you might:
locate paper
locate pen
write greeting
write body
sign letter
locate envelope
place letter in envelope
seal envelope
write your mailing address
look up recipient address
write recipient address
place in postal box
Now there may be additional steps if the letter comes back as "return to sender" such as checking the address etc..
A phone call may have more cases, such as a busy signal, answering machine, person actually picks up the phone, number not in service etc..
Just think through the entire process and any possible outcomes and write the steps for each.
daraptor
12-31-2007, 08:19 PM
thanx man
daraptor
12-31-2007, 09:18 PM
brad...this what i could do with ur suggestion..correct it if am wrong...thanx
step1: search for the number in address book, pickup phone
step2: listen the dialtone, dial the number,listen for a phone response
step3: if call answered talk
else busy signal go to step 4 and repeat from step1
else no one answers leave a message and go to step4
step4: hangup
brad211987
12-31-2007, 09:23 PM
Doesn't look bad, I don't know how detailed this has to be though.
You may want to think about if the phone number is not in service, or has changed, maybe even going to more detail such as locating the phone book. Maybe even what happens if there is no dial tone etc.... Just thinking of anything that would typically go wrong.
daraptor
12-31-2007, 09:44 PM
how does this look brad...
step1: search for number in address book,
step2: pickup phone,listen for dialtone, if no dialtone, call customer service.
step3: dial the number
step4: listen for the ring and wait for some response
step5: if call is answered talk and go to step9
step6: if no response leave a message and go to step9
step7: if there is a busy signal, go to step9 and start from step 2
step8: if calling number out of order or not workin go to step1 and try a different number.
step9: hang up
brad211987
12-31-2007, 09:48 PM
Looks good to me, just be sure that you can relate it to programming, as that was the point of the assignment I'm sure.
daraptor
12-31-2007, 09:54 PM
yeah sure man...thanx
sage45
01-01-2008, 03:47 AM
how does this look brad...
step1: search for number in address book,
step2: pickup phone,listen for dialtone, if no dialtone, call customer service.
step3: dial the number
step4: listen for the ring and wait for some response
step5: if call is answered talk and go to step9
step6: if no response leave a message and go to step9
step7: if there is a busy signal, go to step9 and start from step 2
step8: if calling number out of order or not workin go to step1 and try a different number.
step9: hang upOne thing. Generally in programming a separate thought is a separate step... For example:step1: search for number in address book
step2: pickup phone
step3: if there is a dialtone
step4: dial the number
step5: if there is a ring
step6: wait for some response
step7: if call is answered by a person
step8: talk and go to step17
step9: if call is answered by a machine
step10: leave a message and go to step17
step11: if there is a busy signal
step12: hang up and restart from step2
step13: if calling number out of order or not workin
step14: go to step1 and try a different number.
step15: if there is no dialtone
step16: call customer service
step17: hang upHTH,
-saige-
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.