Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Assignment questions. (100 points)
- Write clear code with comments and follow coding convention. Comments should include your name,
- student number and subject code on top of your code. In this assignment, you must write your own
- functions to make the code clear and efficient.
- In this assignment, we consider the following fictional scenario of a University XYZ.
- This University follows the following policy:
- ● Student number has 7 digits
- ● Student email is a concatenation of student family name (in lowercase), the first character of
- student first name (in lowercase), the last two digits of the student number, and the domain
- @xyz.edu.
- ● Student initial email password is a concatenation of student first name (in uppercase), the first
- two digits of the student number, the first character of student family name (in lowercase), and
- two random digits.
- Below are some examples:
- ● John Smith, student number 1723465, email smithj65@xyz.edu, password JOHN17s05
- ● Mary Jane, student number 0234567, email janem67@xyz.edu, password MARY02j17
- ● Dong Zhang, student number 1445001, email zhangd01@xyz.edu, password DONG14z80
- Question 1. Write a function named generate_email
- ● The function has 3 arguments: student family name, student first name, student number
- ● The function returns the email address
- Question 2. Write a function named generate_password
- ● The function has 3 arguments: student family name, student first name, student number
- ● The function returns the initial password
- Question 3. Write a program that asks the user to enter the student details and then generates the email
- and initial password. The program should run forever until the user wishes to quit. The student details
- are displayed in two-column table where the first column is right aligned and the second column is
- left aligned. The program should work as follows, the text in bold indicates the user input.
- Welcome to XYZ.edu email admin.
- Type q to quit, or c to continue: c
- Page 2 of 3
- Enter student first name: John
- Enter student family name: Smith
- Enter student number: 1723465
- Name: John Smith
- Student number: 1723465
- Email: smithj65@xyz.edu
- Password: JOHN17s49
- Welcome to XYZ.edu email admin.
- Type q to quit, or c to continue: c
- Enter student first name: Mary
- Enter student family name: Jane
- Enter student number: 0234567
- Name: Mary Jane
- Student number: 0234567
- Email: janem67@xyz.edu
- Password: MARY02j09
- Welcome to XYZ.edu email admin.
- Type q to quit, or c to continue: c
- Enter student first name: Dong
- Enter student family name: Zhang
- Enter student number: 1445001
- Name: Dong Zhang
- Student number: 1445001
- Email: zhangd01@xyz.edu
- Password: DONG14z11
- Welcome to XYZ.edu email admin.
- Type q to quit, or c to continue: q
- END OF THE ASSIGNMENT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement