Question: CISC 411 Object & Structure & Algorithm II Assignment 1 (100 pts): Create a module and name it Lostname_Firstname_final.py. For example, John Smith's module would

CISC 411 Object & Structure & Algorithm II Assignment 1 (100 pts): Create a module and name it Lostname_Firstname_final.py. For example, John Smith's module would be Smith_john_final.py. In the module, add the following functions: 1. Write a function named problemi that accepts a list of integers as the argument. Then your function should remove all the odd numbers from the list and sort the remaining non-odd numbers in descending order. Return the list. Call the function and display the return result. Test your function with the test case: if the input list is [1, 6, 4, 3, 7, 2,5), then your function should return (6, 4,2] (10 pts) 2. Write a function named problem2 that accepts a string. Assume the string contains a lot of numbers that are separated by commas. Remove all the duplicates from the list, then calculate and return the sum of remaining elements. Call the function and display the return result. Test your function with this test case: it input string is "1,2,3,3,4,4,5", then your method should return 15. (10 pts) get method for each instance variable. Then create two subclasses Triangle and Rectangle. In both subclasses, add a method areal) to calculate the area of the shape. Create an instance of the Triangle class and an instance of the Rectangle class with the same base=5 and height=10 and then call the areal) function to calculate the corresponding areas. (15 pts) 8. Create a class named Employee. An employee should include five pieces of information as instance variables: name (type str), ID (type str), salary (type int), vacation_days (type int), took_vacation (type bool, default=False) where the instance variable vacations days represents the number of vacations days for that employee this year, and took_vacation represents whether the employee has taken a vacation this year. All the instance variables should be private. Provide a set and a get method for each instance variable. Add a method named take_vacation vacation_time). If the employee has taken a vacation this year, he/she cannot take a vacation again, return "That employee has taken a vacation this year", if the employee hasn't taken any vacations this year, he/she can take a vacation and deduct the vacation time from vacation_days and then set took_vacation to True, return the number of remaining vacation days. Add another method namned compensatel) to calculate and return the compensation for the remaining vacation days (100 dollars per day). Create a subclass named Manager. A manager will get an additional 10 vacation days the first time he/she takes a vacation, and a manager can take vacation twice a year. The take_vacation method in the Manager class should return the number of remaining vacation days or "That employee has taken vocations twice this year" Create an instance of the Employee class and an instance of the Manager class. employee1 = Employee('Alex', 0001', 60000, 10) manager1 - Manager('Rebecca', '0002', 100000, 15) Then call the take_vacation () function, respectively. (25 pts) 3. Write a function named problem that accepts an integer as the argument, find and return the largest dirit in the number. Call the function and display the result. Test your function with the test case: if the given integer is 1325423, then your method should retum 5. (10 pts) , ( 4. Write a function named problem that prompts the user for a sequence of integers and appends them to a list. Each integer can appear only once in the list. You need to ask the user to re-enter a different integer if the entered integer already exists in the list. Calculate and return the sum of the list. Call the function and display the return result. You may test it with the test case: if input sequence 1, 2, 3, 4, 5, then your function should return 15. (10 pts) 2,3,4,5, 5. Write a function named problems that accepts a string as the argument. Assume the string contains single-digit numbers and letters only. Return two strings, one with numbers only, and the other with letters only. Call the function and display the return results. You may test your function with this test case: if the given string is "ab12cd34e5", then your method should return "abcde" and "12345". (10 pts) 6. Write a function named problem that accepts a string as the argument. Assume this string contains a sequence of IP addresses that are separated by commas. Count and return the frequency of each IP address. Call the function and display the return results. Test your function with test case: ips.txt. (10 pts) Submit your file through blackboard Course Material exams final. Add the following classes to Lastname_Firstname_final.py: 7. Create a class named Shape that defines a shape class with a constructor that gives value to base (type float) and height (type float). All the instance variables should be private. Provide a set and a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
