-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
83 lines (61 loc) · 2.58 KB
/
main.cpp
File metadata and controls
83 lines (61 loc) · 2.58 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <vector>
#include <string>
// Header dosyalarını dahil ediyoruz
// (Dosya isimlerin farklıysa burayı düzeltmelisin)
#include "Product.h"
#include "Store.h"
#include "Mall.h"
using namespace std;
int main() {
cout << "--- AVM YONETIM SISTEMI TESTI BASLIYOR ---\n" << endl;
// 1. ADIM: AVM Olusturma
Mall myMall("Eskisehir City Center");
cout << "1. AVM Olusturuldu: " << "Eskisehir City Center" << endl;
// 2. ADIM: Magazalari Olusturma
Store techStore("Teknoloji Dunyasi");
Store bookStore("D&R Kitap");
// 3. ADIM: Urunleri Olusturma ve Magazalara Ekleme
// Teknoloji Mağazası Ürünleri
Product p1("iPhone 15", 50000);
Product p2("Samsung TV", 35000);
Product p3("USB Kablo", 200); // Ucuz urun
techStore.addProduct(p1);
techStore.addProduct(p2);
techStore.addProduct(p3);
// Kitap Mağazası Ürünleri
Product b1("Harry Potter", 450);
Product b2("Yuzuklerin Efendisi", 600);
bookStore.addProduct(b1);
bookStore.addProduct(b2);
cout << "2. Magazalara urunler eklendi." << endl;
// 4. ADIM: Magazalari AVM'ye Ekleme
myMall.addStore(techStore);
myMall.addStore(bookStore);
cout << "3. Magazalar AVM'ye eklendi." << endl;
cout << "--------------------------------------" << endl;
// 5. ADIM: TESTLER
// TEST A: Teknoloji magazasindaki en pahali urunu bulma
// Beklenen: iPhone 15 (50000)
cout << "\n[TEST A] En Pahali Urun Testi:" << endl;
// AVM icindeki ilk magazayi (Teknoloji) cekiyoruz
Store s1 = myMall.getStore(0);
Product pahaliUrun = s1.getMostExpensiveProduct();
cout << "Teknoloji Magazasindaki En Pahali Urun: " << pahaliUrun.getInfo() << endl;
// TEST B: Magaza Bilgisi Yazdirma
cout << "\n[TEST B] Magaza Bilgisi Testi:" << endl;
cout << "Magaza 1: " << s1.getInfo() << endl; // Teknoloji Dunyasi
// TEST C: Magaza Silme (removeStore)
// Beklenen: Son eklenen 'D&R Kitap' silinmeli.
cout << "\n[TEST C] Magaza Silme Testi:" << endl;
cout << "Silmeden onceki durum..." << endl;
// Burada normalde AVM'nin kac magazasi oldugunu yazdiran bir fonksiyon eklemedik ama
// mantiken su an 2 magaza var.
myMall.removeStore(); // Son ekleneni (Kitap magazasini) siler
cout << "Son eklenen magaza silindi." << endl;
// Silindigini dogrulamak icin 0. indexi tekrar cagiralim, hala Teknoloji olmali.
Store kalanMagaza = myMall.getStore(0);
cout << "Kalan Magaza: " << kalanMagaza.getInfo() << endl;
cout << "\n--- TEST BITTI ---" << endl;
return 0;
}