Guest User

Untitled

a guest
Dec 5th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. puts " "
  2. puts "Welecome to my test managment system"
  3.  
  4. select = 0
  5.  
  6. while (select =!6)
  7.  
  8. puts "Press 1 to register a new user (student)"
  9. puts "Press 2 to register a new admin (teacher)"
  10. puts "Press 3 to make new questions"
  11. puts "Press 4 to take the multiple choice test "
  12. puts " 5 to exit"
  13.  
  14. select=gets.to_i
  15.  
  16. if (select==1)
  17.  
  18. class Registerstudent
  19. def initialize(username,password)
  20. @username = username
  21. @password = password
  22. end
  23. end
  24.  
  25. class Registerlistlist < Registerstudent
  26. def initialize(username, password)
  27. super(username, password)
  28.  
  29. end
  30. def get_item
  31. puts " You are now created in the system with the following information
  32. Username: #{@username} " "Password: " " #{@password} "
  33. puts "n The following information is now saved in the Registration file"
  34.  
  35. end
  36. end
  37.  
  38. puts "Welcome to the registration of the new multiple choice program! "
  39.  
  40.  
  41. puts "Please enter your desired username"
  42. username = gets.chomp
  43. puts "Please enter your desired password"
  44. password = gets.chomp
  45.  
  46.  
  47. beit = Registerlistlist.new(username,password)
  48.  
  49. puts beit.get_item
  50.  
  51. f = File.new("Registration.txt", "a+")
  52. f.puts(@username, @password)
  53. f.close
  54. puts "n The following information is now saved in the student Registration
  55. file"
  56.  
  57. elsif (select == 2)
  58.  
  59. class Registeradmin
  60. def initialize(username1,password1)
  61. @username1 = username1
  62. @password1 = password1
  63. end
  64. end
  65.  
  66. class Registerlistlistteacher < Registeradmin
  67. def initialize(username1, password1)
  68. super(username1, password1)
  69.  
  70. end
  71. def get_item
  72. puts " You are now an admin with the following login informaion
  73. Username: #{@username1} " "Password: " " #{@password1} "
  74. puts "n The following information is now saved in the Registration file"
  75.  
  76. end
  77. end
  78.  
  79. puts "Welcome to the registration of the new multiple choice program! "
  80.  
  81.  
  82. puts "Please enter your desired username"
  83. username1 = gets.chomp
  84. puts "Please enter your desired password"
  85. password1 = gets.chomp
  86.  
  87.  
  88. teacher = Registerlistlistteacher.new(username1,password1)
  89.  
  90. puts teacher.get_item
  91.  
  92. f = File.new("Registrationteacher.txt", "a+")
  93. f.puts(@username1, @password1)
  94. f.close
  95. puts "n The following information is now saved in the teacher Registration file"
  96. end
  97. end
Add Comment
Please, Sign In to add comment