-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise8.txt
53 lines (39 loc) · 1.56 KB
/
Exercise8.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-------------------------------------------
Exercise 01 : Classes and objects -- try creating this in oops world
-------------------------------------------
Employee
# instance variables
emp_id
emp_salary
mgr_id
# class variable
department_name
# instance methods
get_emp_salary()-> emp_salary
set_emp_salary(rcv_salary)-> emp_salary
display() --> displays all the values of the attributes of the class
# class method
get_department_name() --> department_name
# static method
field_expertise() --> just displays some expertise for all my employees
main:
main
1) create an object employee(100,1000,1)
2) display the employee object
-------------------------------------------
Exercise 02 : Classes and objects -- try creating this in oops world
-------------------------------------------
Create a class that captures airline tickets.
Each ticket lists the departure and arrival cities, a flight number, and a seat assignment.
A seat assignment has both a row and a letter for the seat within the row (such as 12F).
main method:
Make two examples of tickets being sold to passengers.
display tickets booked details
----- Inheritance exercise ----
1. Define
Person (superclass) that has name , place_of_residence , display_attributes()
Sister (subclass of Person) that has additionally exam_subjects , display_attributes()
Uncle (subclass of Persom) that has additionally business , display_attributes()
main method:
create a sister class object and display its attributes
create a Uncle class object and display its attributes