diff --git a/ItemNo.py b/ItemNo.py new file mode 100644 index 0000000..fef4bbd --- /dev/null +++ b/ItemNo.py @@ -0,0 +1,43 @@ + +class ItemInfo: + def __init__(self, ItCode=0, Item=0, Price=0, Qty=0, Discount=0, Netprice=0): + self.ItCode=ItCode + self.Item=Item + self.Price=Price + self.Qty=Qty + self.Discount=Discount + self.Netprice=Netprice + def Buy(self): + self.ItCode= input("Enter Item Code") + self. Item= input("Enter Item Name") + self.Price= int(input("Enter Price")) + self.Qty= int(input("Enter Quantity")) + self.Discount = self.FindDisc() + self.Netprice = int(self.Price*(100-self.Discount)/100) + def FindDisc(self): + if self.Qty <= 10: + self.Discount = 0 + elif 11 <= self.Qty < 20: + self.Discount = 15 + else: + self.Discount = 20 + + return self.Discount + + def ShowAll(self): + print ("Item Code",self.ItCode) + print ("tem Name",self.Item) + print ("Price",self.Price) + print ("Discount",self.Discount) + print ("NetPrice",self.Netprice) + + def show_All(self): + return """ Item code: {} Item name: {} Item price: {} Item quantity: {} +Item Discount: {} percent Discounted item price: {} + """.format(self.ItCode,self.Item,self.Price,self.Qty, self.Discount, self.Netprice) + + +new_item = ItemInfo() +new_item.Buy() +print(new_item.show_All()) + diff --git a/Product.py b/Product.py new file mode 100644 index 0000000..2681cc2 --- /dev/null +++ b/Product.py @@ -0,0 +1,49 @@ + + +class Product: + + def __init__(self): + self.Pid = "" + self.Pname = "" + self.Pcostprice = 0.0 + self.Psellprice = 0.0 + self.Margin = 0.0 + self.Remarks = "" + + def GetDetails(self): + + self.Pid = input("Enter Product ID:") + self.Pname = input("Enter Product Name :") + self.Pcostprice = input("Enter Cost Price") + self.Psellprice = input("Enter Selling Price") + self.SetRemarks() + + + def SetRemarks(self): + self.Margin = int(self.Psellprice) - int(self.Pcostprice) + if self.Margin < 0: + self.SetRemarks = "Loss " + else: + self.SetRemarks = "Profit" + + def SetDetails(self): + + print ("Product ID:", self.Pid) + print ("Product Name:", self.Pname) + print("Cost Price:", self.Pcostprice) + print("Selling Price:", self.Psellprice) + print("Margin:", self.Margin) + print("Incurred:", self.SetRemarks) + + def showAll(self): + return """ Product ID: {} Product Name: {} + Cost Price: {} + Selling Price: {} + Margin: {} + Incurred: {} + """.format(self.Pid,self.Pname,self.Pcostprice,self.Psellprice, self.Margin, self.SetRemarks) + +new_product=Product() +new_product.GetDetails() +print(new_product.showAll()) + diff --git a/ShopList.py b/ShopList.py new file mode 100644 index 0000000..31116e0 --- /dev/null +++ b/ShopList.py @@ -0,0 +1,75 @@ + + +class Customer(): + def __init__(self): + self.cust_name = "" + self.Cust_Surname = "" + #self.full_name = "" + + + def get_cust_info(self): + self.cust_name = input("Enter Your Name:") + self.Cust_Surname = input("Enter Your Surname") + self.full_name= self.cust_name + " " + self.Cust_Surname + self.Cust_id = Customer_No_list.get(self.full_name) + + + def showAll(self): + print (f"Sayin {self.Cust_id} {self.full_name} aliverise baslayabilirsiniz, urun ve miktarini seciniz:") + print (f"Urun ve Fiyat Listesi: kitap:100, kalem:50, silgi: 50, defter: 200") + return + +Customer_No_list= { "metin tanca": 12346, "mahir canata": 12345 } #girilen isim onceden kayitli mi, musteri nosu nedir bakiyoruz +customer1 = Customer() +customer1.get_cust_info() +print (customer1.showAll()) + +class Items(Customer): + def __init__(self, Cust_name ): + self.Cust_name= Cust_name + self.product =["kitap", "kalem", "silgi", "defter"] + self.price = """{"kitap":100, "kalem":50,"silgi": 50,"defter": 200}""" + self.total_price=0 + self.price_tobe_paid=0 + self.alinan_urun = 0 + self.alinan_urunler=[] + self.alinan_miktarlar=[] + self.qty = 0 + self.total_discount=0 + + def __str__(self): + print(f"musteri kodu:{self.Cust_name} ve urun fiyatlari : {self.price}") + + def calculate_discount(self): + self.total_price= self.price * self.qty + if self.total_price >= 4000: + self.discount=0.25 + elif self.total_price >= 2000: + self.discount=0.15 + elif self.total_price < 2000: + self.discount=0.1 + return self.discount + + def shopping_cart(self): + + self.alinan_urun=input("kirtasiye urununu giriniz: ") + self.price=int(input("fiyatini giriniz? ")) + self.qty=int(input("miktarini giriniz: ")) + + return self.alinan_urun, self.qty + + def get_total_amount(self): + self.price_tobe_paid = self.total_price*(1-self.discount) + self.total_discount=self.total_price*self.discount + return (f"toplam odenen:{self.price_tobe_paid} toplam indirim:{self.total_discount}") + + + def __str__(self): + return f"Alinan urunler {self.alinan_urun} ve toplam odenen {self.price_tobe_paid} ve toplam indirim {self.total_discount}" + +a=Items(Customer) +a.shopping_cart() +a.calculate_discount() +a.get_total_amount() +# print(a.price_tobe_paid) +print(a.__str__()) \ No newline at end of file diff --git a/Society.py b/Society.py new file mode 100644 index 0000000..b4b9645 --- /dev/null +++ b/Society.py @@ -0,0 +1,36 @@ + + +class Society: + def __init__(self, society_name, house_no, no_of_members, flat, income): + # constructor + 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("Enter Society Name:") + self.house_no = input("Enter House Number") + self.no_of_members = input("Enter No.of members") + self.income = int(input("Enter income")) + + def allocate_flat(self): + if self.income >= 25000: + self.flat = "A Type" + elif self.income >= 20000 and self.income < 25000: + self.flat = "B Type" + elif 15_000 <= self.income < 20_000: + self.flat = "C Type" + else: + self.flat = "DType" + + def show_data(self): + + return f"Society name: {self.society_name} \tHouse number: {self.house_no} \tNo of members: {self.no_of_members} \tFlat type: {self.flat} \tIncome: {self.income}" + + +s1 = Society("Dream Apartments", 16, 3, "D type", 18000) # Member S1 +s1.allocate_flat() +print(s1.show_data()) \ No newline at end of file