1. Homepage
  2. Programming
  3. [2022] Monash- FIT9136 Algorithm and programming foundation in Python - Assignment 2 - Simple emulation of data processing

[2022] Monash- FIT9136 Algorithm and programming foundation in Python - Assignment 2 - Simple emulation of data processing

Engage in a Conversation
FIT9136Algorithm and programming foundation in PythonPythonMonash University

3. Key tasks (100 marks) CourseNana.COM

This assignment is a simple emulation of data processing. Your application should be able to ask the user to input username, password to login into your system. The system should be able to identify the role of this user and allow corresponding operations. CourseNana.COM

  CourseNana.COM

This is an individual assignment and must be your own work. CourseNana.COM

  CourseNana.COM

The allowed libraries are random, math, os and re. You will not receive marks for the components if you use any other libraries apart from the mentioned library. CourseNana.COM

  CourseNana.COM

Please finish reading the description of all classes before starting the implementation. CourseNana.COM

  CourseNana.COM

3.1. User class CourseNana.COM

User class handles the fundamental methods of all users. The User class is the parent class of Admin, Instructor and Student classes. CourseNana.COM

  CourseNana.COM

3.1.1 constructor CourseNana.COM

A user must have id(int, default value -1), username(str, default value “”), password(str, default value “”). CourseNana.COM

  CourseNana.COM

3.1.2 generate_unique_user_id() CourseNana.COM

This method checks the files user_admin.txt, user_instructor.txt and user_student.txt to generate an unique user id. The return result is a 10 digits integer. CourseNana.COM

  CourseNana.COM

3.1.3 encryption(input_password) CourseNana.COM

This method encrypts the input_password to a string that is difficult to read by humans. Reuse the encryption algorithm that was in A1 to encode the input password. The encrypted password will be returned and the type is string. CourseNana.COM

  CourseNana.COM

3.1.4 login() CourseNana.COM

Each user can call the login method to perform authentication. In this login() method, it is required to call the encryption() method defined before to encode the password. The encoded password can be used to compare with the password extracted from files. You are required to to check the user_admin.txt, user_instructor.txt and user_student.txt file according to the username and password and return a tuple which contains the login_result(bool type), login_user_role(str type, the values can only be “Admin”, “Instructor”, “Student”), login_user_info(any type e.g. list or tuple CourseNana.COM

or str, this value can be used to create different types of user object (Admin, Student or Instructor)). CourseNana.COM

  CourseNana.COM

3.1.5 extract_info() CourseNana.COM

This method prints out a message “You have no permission to extract information”. CourseNana.COM

  CourseNana.COM

3.1.6 view_courses(args=[]) CourseNana.COM

This method prints out a message “You have no permission to view courses”. CourseNana.COM

  CourseNana.COM

3.1.7 view_users() CourseNana.COM

This method prints out a message “You have no permission to view users”. CourseNana.COM

  CourseNana.COM

3.1.8 view_reviews(args=[]) CourseNana.COM

This method prints out a message “You have no permission to view reviews”. CourseNana.COM

  CourseNana.COM

3.1.9 remove_data() CourseNana.COM

This method prints out a message “You have no permission to remove data”. CourseNana.COM

  CourseNana.COM

3.1.10 __str__() CourseNana.COM

This method returns a formatted user string: “user_id;;;username;;;password”. All the CourseNana.COM

attributes are concatenated using “;;;”. CourseNana.COM

  CourseNana.COM

3.2. Admin class CourseNana.COM

Admin class inherits from the User class. CourseNana.COM

  CourseNana.COM

3.2.1 constructor CourseNana.COM

Admin only have attributes id(int, default value -1), username(str, default value “”) and password(str, default value “”) which can be inherited from the parent class. CourseNana.COM

  CourseNana.COM

3.2.2 register_admin() CourseNana.COM

This method checks the user_admin.txt file to find out whether the username already exists or not. If not, register this admin. If it exists, do nothing. CourseNana.COM

  CourseNana.COM

3.2.3 extract_course_info() CourseNana.COM

This method can get course information from the raw_data.txt. The extracted course info should be saved into file following the format below: “course_id;;;course_title;;;image_100x100;;;headline;;;num_of_subscribers;;;avg_rating;;;course_content_length”. CourseNana.COM

  CourseNana.COM

For each line in the raw_data.txt file, you can copy and paste it to Json Parser Online to check the format. Each line contains more than one course. All the corresponding attributes can be found in the text. You can use the library re or str methods to extract the data. The course content length in the text is like “40.5 hours”. Only 40.5 need to be retrieved. The course data will be saved into the course.txt file. CourseNana.COM

  CourseNana.COM

3.2.4 extract_review_info() CourseNana.COM

This method can get review information from the review_data folder. The extracted review info saving format is “review_id;;;review_content;;;review_rating;;;course_id” The course id can be obtained from each file’s name in the review_data folder. CourseNana.COM

  CourseNana.COM

3.2.5 extract_students_info() CourseNana.COM

This method can get student information from the review_data folder. Each review string contains one user information. Assume each user only has one review. The attributes of each student are id, username, password, user_title, user_image_50x50, user_initials and review_id. If a student’s id cannot be found in the string, you need to generate it by calling the generate_unique_user_id() method defined in the User class. The username should be generated by converting the user_title to lowercase and replacing all the whitespace to underscore. The password is generated by CourseNana.COM

converting user_initials to lowercase and combining the user id. The password expression looks like “user_initials + user_id + user_initials”. User_initials can be obtained from the review data. For example, user_id is 12345, user initials is “DE”, the password is “de12345de”. The student info will be written into file=user_student.txt and the format example is “id;;;username;;;password;;;user_title;;;user_image_50x50;;;user_initials;;;review_id”. CourseNana.COM

  CourseNana.COM

3.2.6 extract_instructor_info() CourseNana.COM

This method extracts information from the raw_data.txt file in the course_data folder. Each course item contains several instructor information. The username is generated by converting the instructor_display_name to lowercase and replacing all the whitespace to underscore. The password uses the instructor id directly. The instructor info saving format example is: CourseNana.COM

“id;;;username;;;password;;;display_name;;;job_title;;;image_100x100;;;course_id1–course_id2–course_id3–course_id4”. CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
FIT9136代写,Algorithm and programming foundation in Python代写,Python代写,Monash University代写,FIT9136代编,Algorithm and programming foundation in Python代编,Python代编,Monash University代编,FIT9136代考,Algorithm and programming foundation in Python代考,Python代考,Monash University代考,FIT9136help,Algorithm and programming foundation in Pythonhelp,Pythonhelp,Monash Universityhelp,FIT9136作业代写,Algorithm and programming foundation in Python作业代写,Python作业代写,Monash University作业代写,FIT9136编程代写,Algorithm and programming foundation in Python编程代写,Python编程代写,Monash University编程代写,FIT9136programming help,Algorithm and programming foundation in Pythonprogramming help,Pythonprogramming help,Monash Universityprogramming help,FIT9136assignment help,Algorithm and programming foundation in Pythonassignment help,Pythonassignment help,Monash Universityassignment help,FIT9136solution,Algorithm and programming foundation in Pythonsolution,Pythonsolution,Monash Universitysolution,