-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathE3-3.py
36 lines (28 loc) · 805 Bytes
/
E3-3.py
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
# Copyright (C) Deepali Srivastava - All Rights Reserved
# This code is part of Python course available on CourseGalaxy.com
class SalesPerson:
total_revenue = 0
names = []
def __init__(self,name,age):
self.name = name
self.age = age
self.sales_amount = 0
SalesPerson.names.append(name)
def make_sale(self,money):
self.sales_amount += money
SalesPerson.total_revenue += money
def show(self):
print(self.name, self.age, self.sales_amount)
s1 = SalesPerson('Bob', 25)
s2 = SalesPerson('Ted', 22)
s3 = SalesPerson('Jack', 27)
s1.make_sale(1000)
s1.make_sale(1200)
s2.make_sale(5000)
s3.make_sale(3000)
s3.make_sale(8000)
s1.show()
s2.show()
s3.show()
print(SalesPerson.total_revenue)
print(SalesPerson.names)