Advertisement
Guest User

Project 1

a guest
Apr 7th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.12 KB | None | 0 0
  1. Tyler Kinney & Ray Jasinski
  2. This our code
  3.  
  4. #Ray and Tyler
  5. import time #Reseached online: http://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python  #It is an import for time
  6. import math #Imports all the math code
  7. import random # imports all the random code.
  8.  
  9.  
  10. def schedual(): #Train Schedule Ray and Tyler
  11.   print "="*50
  12.   print ("  \t\t   T R A I N S")  
  13.   print ("="*50)
  14.   print(' \t  Train schedule to get to school')
  15.   print ( "="*50)
  16.   start = raw_input('\tType prep to continue: ')  
  17.   print "="*50
  18.   if start == 'prep':
  19.    print "What train line do you want to take Montclair booton or Hudson Bergen Lightrail",
  20.   print "="*50  #Code used in a pass assignment #Code from pass assigenment
  21.  
  22. def randomnumb(): #tyler
  23.   rannumber = random.choice([1,2,3,4,5,6])
  24.   while rannumber <= 0:
  25.     ranumber = rannumber + 1
  26.   print 'you rounded a the number %s' % rannumber,
  27.   print '',
  28.   print '',
  29.   main_menu1()
  30.  
  31. def train(): #This is the code for the train schedule Ray
  32.   train = raw_input()
  33.   if train == 'Montclair':
  34.      print ('Do you want to get to hoboken early, on time or late')
  35.   montclair = raw_input()
  36.   if montclair == 'early':
  37.      print 'Trains to hoboken are \n\ndepart 6:28am--7:00am arrives\ndepart 6:40am--7:17am arrives',
  38.      main_menu1()
  39.   elif montclair == 'on time':
  40.      print 'Trains to hoboken are \n\ndepart 7:08am--7:40am arrives',
  41.      main_menu1()
  42.   elif montclair == 'late' :
  43.      print 'Your going to get jub if you dont pick the first three 3 so any other trains dont matter.'
  44.      main_menu1()
  45.   if train == 'hudson bergen lightrail':
  46.      print ('Do you want to get to school early, on time or late')
  47.   hudson = raw_input()
  48.   if hudson == 'early':
  49.      print 'The trains to Marin are \n\ndepart 6:06am--6:22am arrives\ndepart 6:18m--6:34am arrives\ndepart 6:36am--6:52am arrives\ndepart 6:47am--7:03am arrives',
  50.      main_menu1()
  51.   elif hudson == 'on time':
  52.      print 'Trains to Marin are \n\ndepart 7:16am--7:32am arrives\ndepart 7:45am--8:01am arrives',
  53.      main_menu1()
  54.   elif hudson == 'late':
  55.      print ' Your going to get jug if you dont pick the first 6 so any other trains dont matter.'
  56.      main_menu1()
  57.   else:
  58.      print 'you didnt select a choice',
  59.      main_menu1()#code from passed assignment. #Code from pass assignment
  60.  
  61. def systemdi(): #tyler
  62.   loading()
  63. def calculator(): #Calculator Ray and Tyler
  64.   print '1. addiction' #all the options for the calculator.
  65.   print '2. subtraction'
  66.   print '3. multiplication'
  67.   print '4. division'
  68.   print '5. return to main menu'
  69.   calculatorRI = raw_input('choose one')
  70.   if calculatorRI == '1':
  71.     print add(),
  72.     calculator()
  73.   elif calculatorRI == '2':
  74.     print subtract(),
  75.     calculator()
  76.   elif calculatorRI == '3':
  77.     print Multiply(),
  78.     calculator()
  79.   elif calculatorRI == '4':
  80.     print divide(),
  81.     calculator()
  82.   elif calculatorRI == '5':
  83.     print 30*'-',
  84.     main_menu1()
  85.   else:
  86.     print 'not a option'
  87.  
  88. def loading(): #learned from jason davidoff #ray
  89.   print 'Loading'
  90.   time.sleep(1),
  91.   print 30*'-'
  92.   time.sleep(1)
  93.   print 'mouse connection:'
  94.   time.sleep(1)
  95.   print random.choice(['connected','disconnected','error'])
  96.   time.sleep(1)
  97.   print '\n'
  98.   time.sleep(1)
  99.   print 'internet connection:'
  100.   time.sleep(1)
  101.   print random.choice(['connected','disconnected','error'])
  102.   time.sleep(1)
  103.   print '\n'
  104.   time.sleep(1)
  105.   print 'keyboard connection :'
  106.   time.sleep(1)
  107.   print random.choice(['connected','disconnected','error'])
  108.   time.sleep(1)
  109.   print '\n'
  110.   time.sleep(1) #learned from Jason who showed me how to use the time code.
  111.   print 'Moniter:'
  112.   time.sleep(1)
  113.   print random.choice(['connected','disconnected','error'])
  114.   time.sleep(1)
  115.   print '\n'
  116.   time.sleep(1)
  117.   main_menu1()
  118.  
  119.  
  120. def add():   #addiction function    
  121.   print "Enter the numbers"
  122.   A=int(raw_input("Enter 1:"))# the first varialbe
  123.   B=int(raw_input("ENter 2:"))# second variable.
  124.   return A + B #mades is add
  125.  
  126. def subtract():            #subtraction function Ray
  127.   print "Enter the numbers"
  128.   A=int(raw_input("Enter 1:"))
  129.   B=int(raw_input("Enter 2:"))
  130.   return A - B
  131.  
  132. def Multiply(): #multiply ray
  133.   print "Enter the numbers"
  134.   A=int(raw_input("Enter 1:"))
  135.   B=int(raw_input("Enter 2:"))
  136.   return A * B
  137.  
  138. def divide():   #divide ray
  139.   print "Enter the numbers"
  140.   A=int(raw_input("Enter 1:"))
  141.   B=int(raw_input("Enter 2:"))
  142.   return A / B
  143.  
  144. def main_menu1(): #Main menu ray
  145.   print (50 * '-')
  146.   print '1. calculator'
  147.   print '2. train schedule'
  148.   print '3. system diagnostic'
  149.   print '4. reboot'
  150.   print '5. shutdown'
  151.   print '6. logoff'
  152.   print '7. roll dice'
  153.   main_menu = raw_input('what do you want to use')
  154.   if main_menu == '1':
  155.    calculator()
  156.   if main_menu == '2':
  157.    schedual(),
  158.    train()
  159.   elif main_menu == '3':
  160.    systemdi()
  161.   elif main_menu == '4':
  162.    reboot()
  163.   elif main_menu == '5':
  164.    shut_down()
  165.   elif main_menu == '6':
  166.    login()
  167.   elif main_menu == '7':
  168.    randomnumb()
  169.  
  170.  
  171. def shut_down(): #The function to shutdown the computer -Tyler
  172.   print 'shutting down'
  173.   time.sleep(1)
  174.   print '...'
  175.   time.sleep(1)
  176.   print '..'
  177.   time.sleep(1)
  178.   print '.'
  179.   exit()
  180.  
  181.  
  182.  
  183. def admin(): #
  184.   adminoveride = raw_input()
  185.   if adminoveride == 'overide123':
  186.    print 'Welcome %s' %user,
  187.    main_menu1()
  188.   else:
  189.    print 'password fail'  
  190.  
  191. def login():
  192.   print 'logged out'
  193.   time.sleep(1)
  194.   bye = '            ' """ ######::::#######:::#######::########:
  195.            ##... ##::##.... ##:##.... ##:##.... ##
  196.            ##:::..:::##:::: ##:##:::: ##:##:::: ##
  197.            ##::'####:##:::: ##:##:::: ##:##:::: ##
  198.            ##::: ##::##:::: ##:##:::: ##:##:::: ##
  199.            ##::: ##::##:::: ##:##:::: ##:##:::: ##
  200.             ######:::.#######::.#######::########:"""
  201.   bye2 ='            '"""########::'##:::'##:'########:
  202.            ##.... ##:. ##:'##:: ##.....::
  203.            ##:::: ##::. ####::: ##:::::::
  204.            ########::::. ##:::: ######:::
  205.            ##.... ##:::: ##:::: ##...::::
  206.            ##:::: ##:::: ##:::: ##:::::::
  207.            ########::::: ##:::: ########:"""
  208.  
  209.   print bye
  210.   print ' '
  211.   print bye2
  212.   rebootseq2()
  213.  
  214.  
  215. def passwordT(): #Tyler
  216.   print 'please type in password',
  217.   password = raw_input()
  218.   print (30 * '-')
  219.   if password == 'password1234':
  220.     print 'welcome %s'%user,
  221.     main_menu1()
  222.   elif password == "anything":
  223.     print 'work'
  224.   else:
  225.     print 'type admin override',
  226.     admin()
  227.  
  228. def passwordR(): #Ray
  229.   print 'please type in password',
  230.   password = raw_input()
  231.   print (30 * '-')
  232.   if password == 'password1234':
  233.     print 'welcome %s' %user, #The modules makes it so that the input would be the welcome
  234.     main_menu1()
  235.   elif password == "anything":
  236.     print 'work'
  237.   else:
  238.     print 'type admin override',
  239.     admin()
  240.  
  241. def reboot():# RAy
  242.   print 30*'-'
  243.   print 'Restarting computer please wait a few seconds'
  244.   time.sleep(1)
  245.   print '............'
  246.   time.sleep(1)
  247.   print '............'
  248.   time.sleep(1)
  249.   print '............'
  250.   time.sleep(1)
  251.   print '............'
  252.   rebootseq2()
  253.  
  254. def rebootseq2(): # This is to make the reboot start up again -Ray
  255.   print (30 * '-')
  256. print ("   L O G I N")
  257. print (30 * '-')
  258. print 'pick a user'
  259. print '\n admin Ray Jasinski \n Guest Tyler Kinney' #This is definitly made by ray
  260. print (30 *'-')
  261. user = raw_input()
  262. if user == 'tyler': #Made by tyler
  263.  passwordT()
  264. elif user == 'Tyler Kinney':
  265.  passwordT()
  266. elif user == 'Tyler':
  267.  passwordT()
  268. if user == 'ray': #made by ray
  269.  passwordR()
  270. elif user == 'Ray':
  271.  passwordR()
  272. elif user == 'Ray Jasinski':
  273.  passwordR()
  274. else:
  275.  print 'not a option'
  276.  
  277.  
  278.  
  279. print (30 * '-')# The start of the program.
  280. print ("   L O G I N")
  281. print (30 * '-')
  282. print 'pick a user'
  283. print '\n admin Ray Jasinski \n Guest Tyler Kinney' #This is definitly made by ray
  284. print (30 *'-')
  285. user = raw_input()
  286. if user == 'tyler': #Made by tyler
  287.  passwordT()
  288. elif user == 'Tyler Kinney':
  289.  passwordT()
  290. elif user == 'Tyler':
  291.  passwordT()
  292. elif user == 'Kinney':
  293.  passwordT()
  294. if user == 'ray': #made by ray
  295.  passwordR()
  296. elif user == 'Ray':
  297.  passwordR()
  298. elif user == 'Ray Jasinski':
  299.  passwordR()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement