Monday, May 4, 2009

clau.pseudo-code again

I realized what the problem was with my code flow and here I fix it. I hope it is ok. Again I have problems with identation, I don´t know how to controll it in order to have desired order of functions

Buy a train ticket to Berlin in a ticket-vending machine.

For humans
Go to the ticket machine
Press the button Ticket- Reservation
Select the departure and destination cities
Select the date and time
Select the number of travelers
Select the means of transport
Press search button
Select the journey that fit best with your request
Press purchase button and proceed to buy the ticket


For computers
function informationRequest:
with ticketMachine
press ticketMachine.monitor
select ticketReservation.button
press departure.button
with the keyboard on the monitor
write Dessau
press DessauHbf.button
press destination.Key
with the keyboard on the monitor
write Berlin
press BerlinHbf.button
desiredDay = Today
desiredTime = 23:00
desiredTravelers = Adult
desiredTravelers.number = 1
desiredTravel.class= secondClass
desiredMeansTransport = localTransport
press search.button
execute function selectionJourney

function selectionJourney:
on standardFare.column and
along dep 23.17 arr 01:06.row
press purchase.button
execute function buyTicket

function buyTicket:
get credit.Card
with credit.Card
move 20 cm right
move 5 cm up
insert credit.Card inside ticketMachine.slot

when hear “beep” sound
remove creditCard
put creditCard in initial position
with keyboard near ticketMachine.slot
write creditCard.pinCode
press B button
wait monitor change image
move 60 cm down
open window
remove ticket
execute function remove ticket
else:
finish

No comments:

Post a Comment