Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions assignment_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class School():

students=[]

def __init__(self,capacity):
self.capacity=capacity

def add_student(self,student):
if self.capacity == len(self.students):
print("Error! The capacity is full")
else:
self.students.append(student)

def print_students(self):
for i in self.students:
print(i)



class Student():

def __init__(self,name,age,gender):
self.name=name
self.age=age
self.gender=gender

def __str__(self):
return "Name: {} Age: {} Gender: {}".format(self.name,self.age,self.gender)

school=School(2)
student_1=Student("Emrah",30,"Male")
student_2=Student("Furkan",26,"Male")
student_3=Student("Aziz",35,"Male")

school.add_student(student_1)
school.add_student(student_2)
school.add_student(student_3)

school.print_students()
print(school.__dict__)

# student=Student("Emrah",30,"Male")
# print(student)
34 changes: 34 additions & 0 deletions assignment_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class Rectangle():

def __init__(self,length,width):
self.length=length
self.width=width

def perimeter(self):
return 2*(self.length+self.width)

def area(self):
return self.length*self.width

def display(self):
return "\n Length: {}\n Width: {}\n Perimeter: {}\n Area: {}".format(self.length,self.width,self.perimeter(),self.area())


class Parallelepipede(Rectangle):
def __init__(self,length,width,height):
super().__init__(length,width)
self.height=height

def volume(self):
return self.height*self.width*self.length







emrah=Parallelepipede(2,3,4)
print(emrah.volume())
# print(emrah.perimeter())
# print(emrah.area())
40 changes: 40 additions & 0 deletions assignment_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from math import cos


class BankAccount():


def __init__(self,accountNumber,name,balance):
self.accountNumber=accountNumber
self.name=name
self.balance=balance

def deposit(self,d):

self.balance+=d


def withdrawal(self,w):

if w>self.balance:
print("Impossible operation! Insufficient balance!")
else:
self.balance-=w

def bankFees(self):
self.balance-=(self.balance*5)/100

def display(self):
return f"AccountNumber: {self.accountNumber} Name: {self.name} Balance: {self.balance}$"

costumer=BankAccount(12345,"Emrah",500)
print(costumer.display())
costumer.deposit(745)
print(costumer.display())
costumer.withdrawal(327)
print(costumer.display())
costumer.bankFees()
print(costumer.display())



26 changes: 26 additions & 0 deletions assignment_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Person():

def __init__(self,name,age):
self.name=name
self.age=age

def display(self):
return f"""The name of the costumer is {self.name}
The age of the costumer is {self.age}"""


class Student(Person):
def __init__(self, name, age,section):
super().__init__(name, age)
self.section=section

def display(self):
return f"""The name of the student is {self.name}
The age of the student is {self.age}
The section of the student is {self.section}"""

person=Person("Emrah",30)
print(person.display())
print("**************************")
student=Student("Emrah",30,"Engineering")
print(student.display())