Follow the steps below to complete PE:
1. Create a folder to save given projects, e.g. CSD_given (1). Download given materials to (1).
2. Steps to do question 1(do the same for questions 2 and 3): Open Thonny, then edit the MyList.py file according to the requirements of the exam. (edit the file BSTree.py for Q2 and Graph.py for Q3).
3. Submission: to submit the folder Q1, at first you must select Question No = 1, browse and select the project folder (e.g. 1, Q1 or Q1X,...) then click the Submit button. Do the same for other questions.
Do not submit the un-edited given project.
4. Do not use accented Vietnamese when writing comments in programs.
5. Do not add new import statement(s) to given files.
6. Software tools must be used: Thonny
If at least one of the above requirements is not followed, the exam will get ZERO.
Do not pay attention to real meaning of objects, variables and their values in the questions below.
Question 1:(4 marks)
In this question you should complete some methods in MyList.py file.
The class Employee with 3 data members: Name, Age and Salary is given and you do not need to edit it.The MyList class is a linked list of Employee objects. The following methods should be completed:
void f1(self, name, age, salary) - check if name start with "Z" or age < 15 or salary <=0 then do nothing, otherwise add new Employee with Name=name, Age=age and Salary=salary to the first of the list. The age and salary can get arbitrary value, even negative. Output in this case like that OUTPUT
(C, 60, 46) (P, 16, 20) (ΧΗ, 36, 51) (H, 18, 30) (F, 26, 27) (E, 45, 52) (C, 50, 42) (D, 42, 43) (B, 32, 23) (R, 30,30)
Close
+ 100%
Zoom