diff --git a/class_product.py b/class_product.py new file mode 100644 index 0000000..4783999 --- /dev/null +++ b/class_product.py @@ -0,0 +1,30 @@ +class product: + def __init__(self,product_id,product_name,product_purchase_price,product_sale_price,): + self.product_id=product_id + self.product_name=product_name + self.product_purchase_price=product_purchase_price + self.product_sale_price=product_sale_price + + def set_remarks(self): + self.end_price=self.product_sale_price - self.product_purchase_price + if self.end_price<0: + return "Loss" + elif self.end_price>0: + return "Profit" + + def set_details(self): + self.product_id=2546 + self.product_name="Phone" + self.product_purchase_price=420 + self.product_sale_price=500 + self.pr=self.set_remarks() + + + def get_details(self): + print("product_id:", self.product_id, ",product_name:", self.product_name, ",product_purchase_price:", self.product_purchase_price, ",product_sale_price:", self.product_sale_price,) + + +x=product(2546,"phone",420,500) +print(x.set_remarks()) +print(x.set_details()) +print(x.get_details()) \ No newline at end of file diff --git a/class_society.py b/class_society.py new file mode 100644 index 0000000..d84e02e --- /dev/null +++ b/class_society.py @@ -0,0 +1,36 @@ +class Society: + def __init__(self,society_name, house_no, no_of_members, flat, income): + self.society_name=society_name + self.house_no=house_no + self.no_of_members=no_of_members + self.flat=flat + self.income=income + + def input_data(self): + self.society_name=input("society_name'i giriniz") + self.house_no=input("house_no'u giriniz") + self.no_of_members=input("no_of_members 'ı giriniz") + self.flat=input("flat'ı giriniz") + self.income=int(input("income'i giriniz")) + def allacote_flat(self): + if self.income >=25000: + self.flat="A Type" + elif self.income>=20000 and self.income<25000: + self.flat="B Type" + elif self.income>=15000 and self.income<20000: + self.flat="C Type" + elif self.income<15000: + self.flat="D Type" + + + def show_data(self): + """print(self.society_name, self.house_no, self.no_of_members, self.flat, self.income)""" + + + return f"society_name:{self.society_name}\thouse_no:{self.house_no}\tno_of_members:{self.no_of_members}\tflat:{self.flat}\tincome:{self.income}." + +a=Society("street",5,6,4,2) + +print(a.input_data()) +print(a.allacote_flat()) +print(a.show_data()) \ No newline at end of file diff --git "a/class_\304\261temInfo.py" "b/class_\304\261temInfo.py" new file mode 100644 index 0000000..009f196 --- /dev/null +++ "b/class_\304\261temInfo.py" @@ -0,0 +1,55 @@ +class ItemInfo: + + def __init__(self,item_code,item,price,qty,discount,net_price): + self.item_code = item_code + self.item = item + self.price = price + self.qty = qty + self.discount = discount + self.net_price = net_price + + def calculate_discount( self): + + if self.qty<=10: + self.discount=0 + self.message="discount is 0 " + elif self.qty>11 and self.qty<20: + self.discount=15 + self.message="discount is 15 " + elif self.qty >= 20: + self.discount=20 + self.message="discount is 20" + + """self.net_price = self.price * self.qty - self.discount""" + + return self.message + + + + def buy(self,): + self.item_code=int(input("item_code için bir değer giriniz:",)) + self.item=int(input("item için bir değer giriniz:",)) + self.price = int(input("price için bir değer giriniz:",)) + self.qty = int(input("qty için bir değer giriniz:",)) + + self.net_price = self.price * self.qty - self.discount + + return "net_price:" ,self.net_price + + + def show_all(self): + print("item_code:",self.item_code ,"item:",self.item,"price:",self.price,"discount:",self.discount,"qty:",self.qty,"net_price:",self.net_price) + + + +x=ItemInfo(0,10,5,4,6,7) + +print(x.buy()) +print(x.calculate_discount()) +print(x.show_all()) + + + + + +