diff --git a/README.md b/fahri/README.md similarity index 100% rename from README.md rename to fahri/README.md diff --git a/fahri/kutuphane.db b/fahri/kutuphane.db new file mode 100644 index 0000000..e09a699 Binary files /dev/null and b/fahri/kutuphane.db differ diff --git a/fahri/kutuphane.json b/fahri/kutuphane.json new file mode 100644 index 0000000..9340ad6 --- /dev/null +++ b/fahri/kutuphane.json @@ -0,0 +1,15 @@ +{ + "kitaplar": [], + "kullanicilar": [ + { + "ad": "deneme", + "sifre": "Aaf43", + "odunc_kitaplar": [] + }, + { + "ad": "fahri", + "sifre": "Aa123456", + "odunc_kitaplar": [] + } + ] +} \ No newline at end of file diff --git a/fahri/week4.py b/fahri/week4.py new file mode 100644 index 0000000..e6db1bb --- /dev/null +++ b/fahri/week4.py @@ -0,0 +1,418 @@ +#1.Cevap +""" +class Rectangle(): + def __init__(self, width, height): + self.width = width + self.height = height + self.area = self.width * height + self.perimeter = self.width * 2 + self.height * 2 + +rectangle2 = Rectangle(5, 7) +print("area of ​​the rectangle:" , rectangle2.area) +print("perimeter of the rectangle:", rectangle2.perimeter) +""" + +#2.Cevap +""" +class Okul(): + def __init__(self, isim, kurulus_yili): + self.isim = isim + self.kurulus_yili = kurulus_yili + self.ogrenciler = [] + self.ogretmenler = {} + + def yeni_ogrenci_ekle(self, ogrenci_adi,sinif): + self.ogrenciler.append({"isim": ogrenci_adi , "sinif" : sinif}) + print(f"{ogrenci_adi} adlı öğrenci {sinif} sınıfına eklendi.") + + def yeni_ogretmen_ekle(self , ogretmen_adi, brans): + self.ogretmenler[ogretmen_adi] = brans + print(f"{ogretmen_adi} adlı öğretmen {brans} branşı ile eklendi.") + + def ogrenci_listesini_gor(self): + if not self.ogrenciler: + print("Henüz öğrenci yok") + else: + print("Ogrenci Listesi") + for ogrenci in self.ogrenciler: + print(f"- {ogrenci['isim']} (Sınıf: {ogrenci['sinif']})") + + def ogretmen_listesini_gor(self): + if not self.ogretmenler: + print("Henüz öğretmen yok") + else: + print("Ogretmen Listesi") + for ogretmen,brans in self.ogretmenler.items(): + print(f"- {ogretmen} (Branş: {brans})") + +def s2(): + + + + okul1 = Okul("Beykoz Meslek Lisesi" , 1950) + okul1.yeni_ogrenci_ekle("Ahmet", "8D") + okul1.yeni_ogrenci_ekle("Mehmet", "9A") + okul1.yeni_ogretmen_ekle("Fahri Hoca", "Fizik") + okul1.yeni_ogretmen_ekle("Zeynep Hoca", "Biyoloji") + + okul1.ogrenci_listesini_gor() + okul1.ogretmen_listesini_gor() + +""" +""" +#3.Cevap + +class Sekil: + def __init__(self, genislik, yukseklik): + self.genislik = genislik + self.yukseklik = yukseklik + +class Dikdortgen(Sekil): + def calculate_area(self): + return self.genislik * self.yukseklik +class Kare(Sekil): + def calculate_area(self): + return self.genislik * self.yukseklik + +dikdortgen = Dikdortgen(5, 3) +kare = Kare(4, 4) + +print(f"Dikdörtgenin Alanı: {dikdortgen.calculate_area()}") +print(f"Karenin Alanı: {kare.calculate_area()}") + + +#4.Cevap +""" + +""" +class Arac: + def __init__(self, marka, model, yıl): + self.marka = marka + self.model = model + self.yıl = yıl + + def __str__(self): + return f"Marka: {self.marka}, Model: {self.model}, Yıl: {self.yıl}" + + +class Arazi_araci(Arac): + def __init__(self, marka, model, yıl, dortceker): + super().__init__(marka, model, yıl) + self.dortceker = dortceker + + def __str__(self): + return super().__str__() + f", Dört Çeker: {'Evet' if self.dortceker else 'Hayır'}" + + +class Spor_Araba(Arac): + def __init__(self, marka, model, yıl, max_hız): + super().__init__(marka, model, yıl) # sadece 3 parametre gönder + self.max_hız = max_hız + + def __str__(self): + return super().__str__() + f", Maksimum Hız: {self.max_hız} km/s" + + +# Örnekler +arac1 = Arazi_araci("Toyota", "Land Cruiser", 2022, True) +arac2 = Spor_Araba("Ferrari", "488 GTB", 2021, 330) + +print("Arazi Aracı Bilgileri:", arac1) +print("Spor Araba Bilgileri:", arac2) +print("Arazi Aracı:", arac1.dortceker) +print("Spor Aracın Max Hızı:", arac2.max_hız) +""" +#5.Cevap +""" +class Müsteri: + def __init__(self, ad, soyad, tc, telefon): + self.ad = ad + self.soyad = soyad + self.tc = tc + self.telefon = telefon + + def display_information(self): + print("----- Müşteri Bilgileri -----") + print(f"Adı : {self.ad}") + print(f"Soyadı : {self.soyad}") + print(f"TC Kimlik Numarası : {self.tc}") + print(f"Telefon Numarası : {self.telefon}") + + + +class Hesap(Müsteri): + def __init__(self, ad, soyad, tc, telefon, hesap_nu, bakiye=0): + super().__init__(ad, soyad, tc, telefon) + self.hesap_nu = hesap_nu + self.bakiye = bakiye + + def deposit(self, miktar): + self.bakiye+=miktar + print(f"{miktar} TL yatırıldı. Yeni bakiye: {self.bakiye} TL") + + def money_check(self, miktar): + if miktar <= self.bakiye: + self.bakiye -= miktar + print(f"{miktar} TL çekildi. Yeni bakiye: {self.bakiye} TL") + else: + print("❌ Yetersiz bakiye! İşlem gerçekleştirilemedi.") + + def display_balance(self): + print(f"Hesap No: {self.hesap_nu}, Güncel Bakiye: {self.bakiye} TL") + + +musteri1 = Müsteri("Ali", "Yılmaz", "12345678901", "0555 111 22 33") +hesap1 = Hesap("Ali", "Yılmaz", "12345678901", "0555 111 22 33", "TR100200300", 1000) + +print("\n----- Hesap İşlemleri -----") +hesap1.display_balance() +hesap1.deposit(500) +hesap1.money_check(300) +hesap1.money_check(1500) +hesap1.display_balance() + +""" +""" +import json + +# ----------------------------- +# Kitap Sınıfları +# ----------------------------- +class Kitap: + def __init__(self, baslik, yazar, yayin_yili): + self.baslik = baslik + self.yazar = yazar + self.yayin_yili = yayin_yili + self.odunc_alindi_mi = False + self.kim_odunc_aldi = None + + def bilgi_goster(self): + durum = f"Ödünç alındı: {self.kim_odunc_aldi}" if self.odunc_alindi_mi else "Müsait" + return f"{self.baslik} ({self.yazar}, {self.yayin_yili}) - {durum}" + + def odunc_al(self, kullanici): + if not self.odunc_alindi_mi: + self.odunc_alindi_mi = True + self.kim_odunc_aldi = kullanici.ad + kullanici.odunc_kitaplar.append(self.baslik) + return True + return False + + def iade_et(self, kullanici): + if self.odunc_alindi_mi and self.kim_odunc_aldi == kullanici.ad: + self.odunc_alindi_mi = False + self.kim_odunc_aldi = None + kullanici.odunc_kitaplar.remove(self.baslik) + return True + return False + + def to_dict(self): + return { + "tip": self.__class__.__name__, + "baslik": self.baslik, + "yazar": self.yazar, + "yayin_yili": self.yayin_yili, + "odunc_alindi_mi": self.odunc_alindi_mi, + "kim_odunc_aldi": self.kim_odunc_aldi + } + + +class Roman(Kitap): + def __init__(self, baslik, yazar, yayin_yili, tur): + super().__init__(baslik, yazar, yayin_yili) + self.tur = tur + + def to_dict(self): + data = super().to_dict() + data["tur"] = self.tur + return data + + +class Dergi(Kitap): + def __init__(self, baslik, yazar, yayin_yili, sayi): + super().__init__(baslik, yazar, yayin_yili) + self.sayi = sayi + + def to_dict(self): + data = super().to_dict() + data["sayi"] = self.sayi + return data + + +# ----------------------------- +# Kullanıcı Sınıfı +# ----------------------------- +class Kullanici: + def __init__(self, ad, sifre): + self.ad = ad + self.sifre = sifre + self.odunc_kitaplar = [] + + def kitap_odunc_al(self, kitap): + return kitap.odunc_al(self) + + def kitap_iade_et(self, kitap): + return kitap.iade_et(self) + + def odunc_listesi(self): + return self.odunc_kitaplar + + def to_dict(self): + return { + "ad": self.ad, + "sifre": self.sifre, + "odunc_kitaplar": self.odunc_kitaplar + } + + +# ----------------------------- +# Kütüphane Sınıfı +# ----------------------------- +class Kutuphane: + def __init__(self, ad): + self.ad = ad + self.kitaplar = [] + self.kullanicilar = [] + + def kitap_ekle(self, kitap): + self.kitaplar.append(kitap) + + def kullanici_ekle(self, kullanici): + self.kullanicilar.append(kullanici) + + def kitaplari_goster(self): + for idx, kitap in enumerate(self.kitaplar, start=1): + print(f"{idx}. {kitap.bilgi_goster()}") + + def giris_yap(self, ad, sifre): + for kullanici in self.kullanicilar: + if kullanici.ad == ad and kullanici.sifre == sifre: + return kullanici + return None + + def kaydet(self, dosya): + data = { + "kitaplar": [kitap.to_dict() for kitap in self.kitaplar], + "kullanicilar": [k.to_dict() for k in self.kullanicilar] + } + with open(dosya, "w", encoding="utf-8") as f: + json.dump(data, f, indent=4, ensure_ascii=False) + + def yukle(self, dosya): + try: + with open(dosya, "r", encoding="utf-8") as f: + data = json.load(f) + + # Kullanıcıları yükle + self.kullanicilar = [Kullanici(u["ad"], u["sifre"]) for u in data.get("kullanicilar", [])] + for i, u in enumerate(self.kullanicilar): + u.odunc_kitaplar = data["kullanicilar"][i]["odunc_kitaplar"] + + # Kitapları yükle + self.kitaplar = [] + for b in data.get("kitaplar", []): + if b["tip"] == "Roman": + kitap = Roman(b["baslik"], b["yazar"], b["yayin_yili"], b.get("tur", "")) + elif b["tip"] == "Dergi": + kitap = Dergi(b["baslik"], b["yazar"], b["yayin_yili"], b.get("sayi", "")) + else: + kitap = Kitap(b["baslik"], b["yazar"], b["yayin_yili"]) + kitap.odunc_alindi_mi = b["odunc_alindi_mi"] + kitap.kim_odunc_aldi = b["kim_odunc_aldi"] + self.kitaplar.append(kitap) + + except FileNotFoundError: + pass + + +# ----------------------------- +# Program Akışı +# ----------------------------- +def main(): + kutuphane = Kutuphane("Merkez Kütüphane") + kutuphane.yukle("kutuphane.json") + + print("📚 KÜTÜPHANE SİSTEMİNE HOŞGELDİNİZ") + + # Giriş ekranı + while True: + secim = input("1- Giriş Yap\n2- Yeni Hesap Oluştur\nSeçiminiz: ") + if secim == "1": + ad = input("Kullanıcı adı: ") + sifre = input("Şifre: ") + kullanici = kutuphane.giris_yap(ad, sifre) + if kullanici: + print(f"✅ Hoş geldiniz, {kullanici.ad}") + break + else: + print("❌ Hatalı kullanıcı adı veya şifre.") + elif secim == "2": + ad = input("Yeni kullanıcı adı: ") + sifre = input("Şifre: ") + kullanici = Kullanici(ad, sifre) + kutuphane.kullanici_ekle(kullanici) + print("✅ Hesap oluşturuldu, giriş yapıldı.") + break + else: + print("Geçersiz seçim!") + + # Menü + while True: + print("\n----- MENÜ -----") + print("1 - Tüm kitapları listele") + print("2 - Kitap ödünç al") + print("3 - Kitap iade et") + print("4 - Ödünç aldığım kitaplar") + print("5 - Kaydet ve çık") + + secim = input("Seçiminiz: ") + + if secim == "1": + kutuphane.kitaplari_goster() + + elif secim == "2": + kutuphane.kitaplari_goster() + idx = int(input("Ödünç almak istediğiniz kitabın numarası: ")) - 1 + if 0 <= idx < len(kutuphane.kitaplar): + if kullanici.kitap_odunc_al(kutuphane.kitaplar[idx]): + print("✅ Kitap ödünç alındı.") + else: + print("❌ Kitap zaten ödünç alınmış.") + else: + print("❌ Geçersiz seçim.") + + elif secim == "3": + if not kullanici.odunc_kitaplar: + print("Ödünç aldığınız kitap yok.") + else: + for i, baslik in enumerate(kullanici.odunc_kitaplar, start=1): + print(f"{i}. {baslik}") + idx = int(input("İade etmek istediğiniz kitabın numarası: ")) - 1 + if 0 <= idx < len(kullanici.odunc_kitaplar): + baslik = kullanici.odunc_kitaplar[idx] + kitap = next(b for b in kutuphane.kitaplar if b.baslik == baslik) + if kullanici.kitap_iade_et(kitap): + print("✅ Kitap iade edildi.") + else: + print("❌ Geçersiz seçim.") + + elif secim == "4": + if not kullanici.odunc_kitaplar: + print("Ödünç aldığınız kitap yok.") + else: + print("📖 Ödünç aldığınız kitaplar:") + for b in kullanici.odunc_kitaplar: + print("-", b) + + elif secim == "5": + kutuphane.kaydet("kutuphane.json") + print("💾 Veriler kaydedildi. Çıkılıyor...") + break + + else: + print("❌ Geçersiz seçim!") + + +if __name__ == "__main__": + main() +""" \ No newline at end of file diff --git a/muhammet/mini kutup.py b/muhammet/mini kutup.py new file mode 100644 index 0000000..7e28696 --- /dev/null +++ b/muhammet/mini kutup.py @@ -0,0 +1,238 @@ +import json +import os + + +# ========== Kitap Sınıfları ========== +class Book: + def __init__(self, title, author, publication_year): + self.title = title + self.author = author + self.publication_year = publication_year + self.is_borrowed = False + self.borrowed_by = None + + def show_info(self): + status = f"Ödünçte ({self.borrowed_by})" if self.is_borrowed else "Müsait" + print(f"{self.title} - {self.author} ({self.publication_year}) | Durum: {status}") + + def borrow(self, user): + if not self.is_borrowed: + self.is_borrowed = True + self.borrowed_by = user.name + user.borrowed_books.append(self.title) + print(f"{self.title} başarıyla ödünç alındı.") + else: + print(f"{self.title} zaten ödünç alınmış!") + + def return_book(self, user): + if self.is_borrowed and self.borrowed_by == user.name: + self.is_borrowed = False + self.borrowed_by = None + user.borrowed_books.remove(self.title) + print(f"{self.title} başarıyla iade edildi.") + else: + print("Bu kitabı iade edemezsiniz!") + + def to_dict(self): + return { + "title": self.title, + "author": self.author, + "publication_year": self.publication_year, + "is_borrowed": self.is_borrowed, + "borrowed_by": self.borrowed_by, + "type": "Book" + } + + +class Novel(Book): + def __init__(self, title, author, publication_year, genre): + super().__init__(title, author, publication_year) + self.genre = genre + + def to_dict(self): + data = super().to_dict() + data["genre"] = self.genre + data["type"] = "Novel" + return data + + +class Magazine(Book): + def __init__(self, title, author, publication_year, issue): + super().__init__(title, author, publication_year) + self.issue = issue + + def to_dict(self): + data = super().to_dict() + data["issue"] = self.issue + data["type"] = "Magazine" + return data + + +# ========== Kullanıcı Sınıfı ========== +class User: + def __init__(self, name, password): + self.name = name + self.password = password + self.borrowed_books = [] + + def borrow_book(self, book): + book.borrow(self) + + def return_book(self, book): + book.return_book(self) + + def list_borrowed_books(self): + if not self.borrowed_books: + print("Henüz ödünç alınmış kitabınız yok.") + else: + print("Ödünç alınan kitaplar:") + for title in self.borrowed_books: + print(f"- {title}") + + def to_dict(self): + return { + "name": self.name, + "password": self.password, + "borrowed_books": self.borrowed_books + } + + +# ========== Kütüphane Sınıfı ========== +class Library: + def __init__(self, name): + self.name = name + self.books = [] + self.users = [] + + def add_book(self, book): + self.books.append(book) + + def add_user(self, user): + self.users.append(user) + + def show_all_books(self): + if not self.books: + print("Kütüphanede hiç kitap yok.") + else: + for i, book in enumerate(self.books, start=1): + print(f"{i}. ", end="") + book.show_info() + + def login(self, name, password): + for user in self.users: + if user.name == name and user.password == password: + print(f"Hoşgeldiniz, {name}!") + return user + print("Kullanıcı adı veya şifre hatalı.") + return None + + def save(self, file): + data = { + "name": self.name, + "books": [book.to_dict() for book in self.books], + "users": [user.to_dict() for user in self.users] + } + with open(file, "w", encoding="utf-8") as f: + json.dump(data, f, ensure_ascii=False, indent=4) + print("📁 Veriler kaydedildi.") + + def load(self, file): + if not os.path.exists(file): + return + with open(file, "r", encoding="utf-8") as f: + data = json.load(f) + + self.name = data["name"] + + # Kitapları geri yükle + self.books = [] + for b in data["books"]: + if b["type"] == "Novel": + book = Novel(b["title"], b["author"], b["publication_year"], b["genre"]) + elif b["type"] == "Magazine": + book = Magazine(b["title"], b["author"], b["publication_year"], b["issue"]) + else: + book = Book(b["title"], b["author"], b["publication_year"]) + book.is_borrowed = b["is_borrowed"] + book.borrowed_by = b["borrowed_by"] + self.books.append(book) + + # Kullanıcıları geri yükle + self.users = [] + for u in data["users"]: + user = User(u["name"], u["password"]) + user.borrowed_books = u["borrowed_books"] + self.users.append(user) + + +# ========== Ana Program ========== +def main(): + lib = Library("Merkez Kütüphane") + lib.load("library.json") + + # Örnek veri ekleyelim (ilk açılışta) + if not lib.books: + lib.add_book(Novel("Sefiller", "Victor Hugo", 1862, "Dram")) + lib.add_book(Magazine("Bilim Dergisi", "TÜBİTAK", 2023, "Ekim")) + lib.add_book(Book("Python 101", "Guido van Rossum", 1991)) + + while True: + print("\n=== Kütüphane Yönetim Sistemi ===") + print("1 - Giriş Yap") + print("2 - Kayıt Ol") + print("3 - Çıkış") + secim = input("Seçiminiz: ") + + if secim == "1": + name = input("Kullanıcı adı: ") + password = input("Şifre: ") + user = lib.login(name, password) + if user: + while True: + print("\n--- Menü ---") + print("1 - Tüm kitapları listele") + print("2 - Kitap ödünç al") + print("3 - Kitap iade et") + print("4 - Ödünç aldığım kitaplar") + print("5 - Kaydet ve çık") + choice = input("Seçiminiz: ") + + if choice == "1": + lib.show_all_books() + elif choice == "2": + lib.show_all_books() + idx = int(input("Kaç numaralı kitabı ödünç almak istiyorsunuz? ")) - 1 + if 0 <= idx < len(lib.books): + user.borrow_book(lib.books[idx]) + elif choice == "3": + user.list_borrowed_books() + title = input("İade etmek istediğiniz kitabın adı: ") + for book in lib.books: + if book.title == title: + user.return_book(book) + break + else: + print("Böyle bir kitabınız yok.") + elif choice == "4": + user.list_borrowed_books() + elif choice == "5": + lib.save("library.json") + return + else: + print("Geçersiz seçim.") + + elif secim == "2": + name = input("Kullanıcı adı: ") + password = input("Şifre: ") + lib.add_user(User(name, password)) + print("Kullanıcı başarıyla oluşturuldu.") + + elif secim == "3": + lib.save("library.json") + break + else: + print("Geçersiz seçim!") + + +if __name__ == "__main__": + main() diff --git a/muhammet/s1.py b/muhammet/s1.py new file mode 100644 index 0000000..057b3d0 --- /dev/null +++ b/muhammet/s1.py @@ -0,0 +1,19 @@ +class Dikdortgen(): + def __init__(self, kisa_kenar, uzun_kenar): + self.kisa_kenar = kisa_kenar + self.uzun_kenar = uzun_kenar + + def alan(self): + return self.kisa_kenar * self.uzun_kenar + + def cevre(self): + return 2 * (self.kisa_kenar + self.uzun_kenar) + + +dikdortgen1 = Dikdortgen(5, 10) +print("Dikdörtgenin alanı:", dikdortgen1.alan()) + + +print("Dikdörtgenin cevresi:", dikdortgen1.cevre()) + + \ No newline at end of file diff --git a/muhammet/s2.py b/muhammet/s2.py new file mode 100644 index 0000000..9b00a3a --- /dev/null +++ b/muhammet/s2.py @@ -0,0 +1,48 @@ +class Okul: + def __init__(self, isim, kuruluş_yılı): + self.isim = isim + self.kuruluş_yılı = kuruluş_yılı + self.öğrenciler = [] # öğrencileri sözlük olarak tutacağız: {"isim": ..., "sınıf": ...} + self.öğretmenler = [] # öğretmenleri sözlük olarak tutacağız: {"isim": ..., "branş": ...} + + def add_new_student(self, student_name, sınıf): + yeni_öğrenci = {"isim": student_name, "sınıf": sınıf} + self.öğrenciler.append(yeni_öğrenci) + print(f"{student_name} adlı öğrenci {sınıf} sınıfına eklendi.") + + def add_new_teacher(self, teacher_name, branch): + yeni_öğretmen = {"isim": teacher_name, "branş": branch} + self.öğretmenler.append(yeni_öğretmen) + print(f"{teacher_name} adlı öğretmen {branch} branşına eklendi.") + + def view_student_list(self): + if not self.öğrenciler: + print("Henüz öğrenci yok.") + else: + print(f"{self.isim} Okulundaki Öğrenciler:") + for öğrenci in self.öğrenciler: + print(f"- {öğrenci['isim']} ({öğrenci['sınıf']} sınıfı)") + + def view_teacher_list(self): + if not self.öğretmenler: + print("Henüz öğretmen yok.") + else: + print(f"{self.isim} Okulundaki Öğretmenler:") + for öğretmen in self.öğretmenler: + print(f"- {öğretmen['isim']} ({öğretmen['branş']} öğretmeni)") + + +# Okul oluşturma +okul = Okul("Hilversum Anadolu Lisesi", 1998) + +# Öğrenci ekleme +okul.add_new_student("Ahmet Yılmaz", "10A") +okul.add_new_student("Ayşe Demir", "9B") + +# Öğretmen ekleme +okul.add_new_teacher("Mehmet Kaya", "Matematik") +okul.add_new_teacher("Fatma Koç", "Fizik") + +# Listeleri görüntüleme +okul.view_student_list() +okul.view_teacher_list() diff --git a/muhammet/s3.py b/muhammet/s3.py new file mode 100644 index 0000000..144b63a --- /dev/null +++ b/muhammet/s3.py @@ -0,0 +1,25 @@ +# Ana sınıf (Şekil) +class Sekil: + def __init__(self, genislik, yukseklik): + self.genislik = genislik + self.yukseklik = yukseklik + + +# Dikdörtgen sınıfı +class Dikdortgen(Sekil): + def calculate_area(self): + return self.genislik * self.yukseklik + + +# Kare sınıfı +class Kare(Sekil): + def calculate_area(self): + return self.genislik * self.yukseklik + + +# Örnek kullanımlar: +dikdortgen = Dikdortgen(5, 10) # genişlik=5, yükseklik=10 +kare = Kare(7, 7) # genişlik=7, yükseklik=7 + +print(f"Dikdörtgenin Alanı: {dikdortgen.calculate_area()}") +print(f"Karenin Alanı: {kare.calculate_area()}") diff --git a/muhammet/s4.py b/muhammet/s4.py new file mode 100644 index 0000000..1a24bdf --- /dev/null +++ b/muhammet/s4.py @@ -0,0 +1,42 @@ +# Temel sınıf +class Vehicle: + def __init__(self, marka, model, yil): + self.marka = marka + self.model = model + self.yil = yil + + def display_info(self): + print(f"Marka: {self.marka}, Model: {self.model}, Yıl: {self.yil}") + + +# Arazi Aracı (SUV) sınıfı +class SUV(Vehicle): + def __init__(self, marka, model, yil, dort_ceker): + super().__init__(marka, model, yil) + self.dort_ceker = dort_ceker # True/False + + def display_info(self): + super().display_info() + print(f"Dört Tekerlekten Çekiş: {'Evet' if self.dort_ceker else 'Hayır'}") + + +# Spor Araba sınıfı +class SportCar(Vehicle): + def __init__(self, marka, model, yil, max_speed): + super().__init__(marka, model, yil) + self.max_speed = max_speed + + def display_info(self): + super().display_info() + print(f"Maksimum Hız: {self.max_speed} km/s") + + +# Örnek kullanım +suv_arac = SUV("Toyota", "Land Cruiser", 2022, True) +spor_araba = SportCar("Ferrari", "488 GTB", 2021, 330) + +print("SUV Aracı Özellikleri:") +suv_arac.display_info() + +print("\nSpor Araba Özellikleri:") +spor_araba.display_info() diff --git a/muhammet/s5.py b/muhammet/s5.py new file mode 100644 index 0000000..a9b93be --- /dev/null +++ b/muhammet/s5.py @@ -0,0 +1,50 @@ +# Müşteri sınıfı +class Musteri: + def __init__(self, isim, soyad, tc_identification, telefon): + self.isim = isim + self.soyad = soyad + self.tc_identification = tc_identification + self.telefon = telefon + + def display_information(self): + print(f"Müşteri Bilgileri:\n" + f"Ad: {self.isim}\n" + f"Soyad: {self.soyad}\n" + f"TC: {self.tc_identification}\n" + f"Telefon: {self.telefon}") + + +# Hesap sınıfı (Müşteri'den miras alıyor) +class Hesap(Musteri): + def __init__(self, isim, soyad, tc_identification, telefon, hesap_numarasi, bakiye=0): + super().__init__(isim, soyad, tc_identification, telefon) + self.hesap_numarasi = hesap_numarasi + self.bakiye = bakiye + + def deposit(self, amount): + self.bakiye += amount + print(f"{amount} TL yatırıldı. Yeni bakiye: {self.bakiye} TL") + + def money_check(self, amount): + if self.bakiye >= amount: + self.bakiye -= amount + print(f"{amount} TL çekildi. Kalan bakiye: {self.bakiye} TL") + else: + print("Yetersiz bakiye! İşlem gerçekleştirilemedi.") + + def display_balance(self): + print(f"Hesap Numarası: {self.hesap_numarasi} | Güncel Bakiye: {self.bakiye} TL") + + +# Müşteri oluşturma +musteri1 = Hesap("Ahmet", "Yılmaz", "12345678901", "0555 111 22 33", "TR100200300", 500) + +# Müşteri bilgilerini görüntüleme +musteri1.display_information() + +# Hesap işlemleri +musteri1.display_balance() +musteri1.deposit(200) +musteri1.money_check(100) +musteri1.money_check(700) # Yetersiz bakiye durumu +musteri1.display_balance()