Advertisement
Guest User

Untitled

a guest
May 15th, 2017
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. Assignment questions. (100 points)
  2. Write clear code with comments and follow coding convention. Comments should include your name,
  3. student number and subject code on top of your code. In this assignment, you must write your own
  4. functions ​to make the code clear and efficient.
  5. In this assignment, we consider the following fictional scenario of a University XYZ.
  6. This University follows the following policy:
  7. ● Student number has 7 digits
  8. ● Student email is a concatenation of student family name (in lowercase​), the first character of
  9. student first name (in lowercase​), the last two digits of the student number, and the domain
  10. @xyz.edu.
  11. ● Student initial email password is a concatenation of student first name (in uppercase​), the first
  12. two digits of the student number, the first character of student family name (in lowercase​), and
  13. two random digits.
  14. Below are some examples:
  15. ● John Smith, student number 1723465, email smithj65@xyz.edu, password JOHN17s05
  16. ● Mary Jane, student number 0234567, email janem67@xyz.edu, password MARY02j17
  17. ● Dong Zhang, student number 1445001, email zhangd01@xyz.edu, password DONG14z80
  18. Question 1. ​Write a function named generate_email
  19. ● The function has 3 arguments: student family name, student first name, student number
  20. ● The function returns the email address
  21. Question 2.​ Write a function named generate_password
  22. ● The function has 3 arguments: student family name, student first name, student number
  23. ● The function returns the initial password
  24. Question 3. ​Write a program that asks the user to enter the student details and then generates the email
  25. and initial password. The program should run forever until the user wishes to quit. The student details
  26. are displayed in two-column table where the first column is right aligned and the second column is
  27. left aligned​. The program should work as follows, the text in bold​ indicates the user input.
  28. Welcome to XYZ.edu email admin.
  29. Type q to quit, or c to continue: c
  30. Page 2 of 3
  31. Enter student first name: John
  32. Enter student family name: Smith
  33. Enter student number: 1723465
  34. Name: John Smith
  35. Student number: 1723465
  36. Email: smithj65@xyz.edu
  37. Password: JOHN17s49
  38. Welcome to XYZ.edu email admin.
  39. Type q to quit, or c to continue: c
  40. Enter student first name: Mary
  41. Enter student family name: Jane
  42. Enter student number: 0234567
  43. Name: Mary Jane
  44. Student number: 0234567
  45. Email: janem67@xyz.edu
  46. Password: MARY02j09
  47. Welcome to XYZ.edu email admin.
  48. Type q to quit, or c to continue: c
  49. Enter student first name: Dong
  50. Enter student family name: Zhang
  51. Enter student number: 1445001
  52. Name: Dong Zhang
  53. Student number: 1445001
  54. Email: zhangd01@xyz.edu
  55. Password: DONG14z11
  56. Welcome to XYZ.edu email admin.
  57. Type q to quit, or c to continue: q
  58. END OF THE ASSIGNMENT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement