Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. //Exams Costs
  2. //Lee Slater
  3. //5.11.14
  4.  
  5. GLOBAL password_code, no_of_tickets, cost_per_ticket, total_cost
  6.  
  7. on mouseUp
  8. initialise _variables
  9. get_subjects_no
  10. calculate_cost
  11. display_cost
  12. end mouseUp
  13.  
  14. on initialise _variables
  15. PUT "" INTO password_code //string
  16. PUT 0 INTO no_of_tickets //integer
  17. PUT 5.99 INTO cost_per_ticket //real
  18. PUT 0.00 INTO total_cost //real
  19. end initialise
  20.  
  21. on get_ticket_no
  22. REPEAT UNTIL password_code="pa55ticket"
  23. ASK "Please enter your password code"
  24. IF the result = "cancel" THEN exit to top
  25. PUT it INTO password_code
  26. IF password_code <> "pa55ticket" THEN ANSWER "Sorry, wrong try again"
  27. PUT it INTO password_code
  28. end REPEAT
  29. ASK "how many tickets do you want to buy?"
  30. PUT it INTO no_of_tickets
  31. end get_ticket_no
  32.  
  33. on calculate_cost
  34. PUT no_of_tickets*cost_per_ticket INTO total_cost
  35. end calculate_cost
  36.  
  37.  
  38. on display_cost
  39. SET numberformat TO "00.00"
  40. PUT "You are wanting"&&no_of_tickets&&"tickets"&RETURN AFTER field"output"
  41. PUT "The total cost is £"&total_cost &RETURN AFTER field "output"
  42. end display_cost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement