desousam

FInal code

Jun 1st, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.25 KB | None | 0 0
  1. # A Code By Mike Desousa
  2. #Imports were used because both math and strings are needed in order to complete the code and global variable for the whole code.
  3. import math
  4. import string
  5. global cars
  6. global cars1
  7. cars = [("WRX", "FocusRS")]
  8. cars1 = 2
  9.  
  10. #Here I defined listc for when the My Vehicles option is called
  11. def listc():
  12. cars
  13. cars1
  14. print "Hello, How can I help you?"
  15. print "1. My Vehicles"
  16. print "2. Alphabetical Order"
  17. choice = raw_input(">")
  18. choice = int(choice)
  19. if choice == 1 :
  20. while cars1 < 3 :
  21. print "Would you like to add a vehicle?"
  22. print "1. I would like to add a vehicle."
  23. print "2. I would not like to add a vehicle"
  24. choice1 = raw_input(">")
  25. choice1 = int(choice1)
  26. if choice1 == 1 :
  27. addcars()
  28. elif choice1 == 2 :
  29. print "Ok"
  30. listc()
  31. else:
  32. print "Invalid answer"
  33. listc()
  34. print cars1
  35. SCAT()
  36. elif choice == 2 :
  37. alphabetize = raw_input("Would you like to put them in alphabetical order?")
  38. if alphabetize == "yes":
  39. print "FocusRS /n WRX"
  40. SCAT()
  41. elif alphabetize == "no":
  42. print "Ok"
  43. SCAT()
  44. else:
  45. print "Invalid answer"
  46. listc()
  47. else:
  48. print "Invalid Answer"
  49. listc()
  50. #This is the Main Menu Function you will be encounter when you first go into the code
  51. def SCAT():
  52. print "Welcome to the Self-Kept Car Assembly Technology also known as SCAT"
  53. print "___________________________________"
  54. name = raw_input("Type in your username:")
  55. password = raw_input("Type in your password:")
  56. print "Hello %s,What are your wishes?" % name
  57. print "1. My Vehicles"
  58. print "2. Add Vehicles"
  59. print "3. Delete Vehicles"
  60. print "4.Edit Vehicles"
  61. print "5. Exit Program"
  62. option = raw_input(">")
  63. option = int(option)
  64. if option == 1:
  65. listc()
  66. elif option == 2:
  67. addcars()
  68. elif option == 3:
  69. delete()
  70. elif option == 4:
  71. edit()
  72. elif option == 5:
  73. exit
  74. else:
  75. print "Invalid answer"
  76. SCAT()
  77.  
  78.  
  79.  
  80. # Here I added a function to give the option to add cars to the List of availavle vehicles
  81. def addcars():
  82. cars
  83. cars1
  84. print "This is the car menu"
  85. print "What would you like to do?"
  86. print "1. Add Vehicles"
  87. print "2. Return to main menu"
  88. acar = raw_input(">")
  89. acar = int(acar)
  90. if acar == 1 :
  91. while cars1 < 3 :
  92. print "Would you like to add a vehicle?"
  93. print "1. I would like to add a vehicle."
  94. print "2. I would not like to add a vehicle"
  95. choice1 = raw_input(">")
  96. choice1 = int(choice1)
  97. if choice1 == 1 :
  98. ncar = raw_input("What type of vehicle do you want to add?")
  99. print "You want to add a/an %s? Are you sure?" % ncar
  100. print "1. Yes"
  101. print "2. No"
  102. ncar1 = raw_input(">")
  103. ncar1 = int(ncar1)
  104. if ncar1 == 1:
  105. print "WRX, FocusRS, %s" % ncar
  106. print "What would you like to do next?"
  107. print "1. Edit"
  108. print "2. Delete"
  109. print "3. Exit Program"
  110. choicer = raw_input(">")
  111. choicer = int(choicer)
  112. if choicer == 1 :
  113. color = raw_input("What color do you want it to be?")
  114. print "So you want your %s to be %s" % (ncar, color)
  115. print "Ok bringing you back to the main menu"
  116. SCAT()
  117. elif choicer == 2 :
  118. delete()
  119. elif choicer == 3 :
  120. print "Leaving program."
  121. break
  122. elif choice1 == 2 :
  123. print "Ok"
  124. addcars()
  125. else:
  126. print "Invalid answer"
  127. addcars()
  128. print cars
  129. elif acar == 2 :
  130. SCAT()
  131. else:
  132. print "Invalid answer"
  133. addcars()
  134.  
  135. # Now I added a option to delete cars from the list in order to add new ones.
  136. def delete():
  137. cars
  138. cars1
  139. while cars1 < 3:
  140. print "Are you sure you want to delete?\n1.Yes\n2.No"
  141. choice = raw_input(">")
  142. choice = int(choice)
  143. if choice == 1 :
  144. choice2 == raw_input("What vehicle do you want to delete?")
  145. if choice == "WRX":
  146. print "FocusRS"
  147. if choice == "FocusRS":
  148. print "WRX"
  149. if choice == 2:
  150. print "Bringing you back to the main menu"
  151. SCAT()
  152.  
  153. # lastly we have our edit function which lets you change car colors.
  154. def edit():
  155. cars
  156. cars1
  157. while cars1 < 3: # While loop that states if you should delete car or not
  158. print "Are you sure you want to edit?\n1.Yes\n2.No"
  159. choice = raw_input(">")
  160. if choice == 1:
  161. ccar = raw_input("What Vehicle do you want to customize?")
  162. ccar1 = raw_input("What color do you want to make %s ?") % ccar
  163. print "So you want to make your %s a shade of %s, sounds good to me." % (ccar, ccar1)
  164. SCAT()
  165. elif choice == 2:
  166. print "Returning to main menu"
  167. SCAT()
  168.  
  169. #The main Menu
  170. print "Welcome to the Self-Kept Car Assembly Technology also known as SCAT"
  171. print "____________________________________"
  172. name = raw_input("Type in your username:")
  173. password = raw_input("Type in your password:")
  174. print "Hello %s,What are your wishes?" % name
  175. print "1. My Vehicles"
  176. print "2. Add Vehicles"
  177. print "3. Delete Vehicles"
  178. print "4. Edit Vehicles"
  179. print "5. Exit Program"
  180. option = raw_input(">")
  181. option = int(option)
  182. if option == 1 :
  183. listc()
  184. elif option == 2:
  185. addcars()
  186. elif option == 3 :
  187. delete()
  188. elif option == 4 :
  189. edit()
  190. elif option == 5 :
  191. exit
  192. else:
  193. print "Invalid Answer"
  194. SCAT()
Add Comment
Please, Sign In to add comment