-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbenzinlik.java
123 lines (96 loc) · 2.67 KB
/
benzinlik.java
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package projeler3;
import java.util.Scanner;
public class benzinlik {
public static void main(String[] args) {
/*
SORU 39 :
BENZİLİĞE GELEN ARACLARIN ALDIĞI BENZIN SONCUNDA 4 ARABA MARKASINDAN HANGİSİNIN EN FAZLA GELDİĞİ VE EN FAZLA BENZIN ALDIĞI
GİBİ DEĞERLERİ HESAPLAYAN PROGRAM.
*/
Scanner input = new Scanner(System.in);
int aracKodu;
int tutar;
int reno=0 , mazda=0 , honda=0 , ford=0 ,enBuyuk =0;
int Treno=0 , Tmazda=0 , Thonda=0 , Tford=0, TenBuyuk=0;
System.out.println("PROGRAMDAN CIKMAK ICIN MARKA OLARAK 111 GIRINIZ.");
System.err.println("------------------------------------------------------------------------");
do {
System.out.print("Marka , Tutar giriniz : ");
aracKodu = input.nextInt();
tutar = input.nextInt();
switch (aracKodu) {
case 1:
reno++;
Treno +=tutar;
break;
case 2:
mazda++;
Tmazda += tutar;
break;
case 3:
honda++;
Thonda +=tutar;
break;
case 4:
ford++;
Tford +=tutar;
break;
case 111:
break;
default:
System.out.println("YANLIS ARAC KODU GIRDINIZ TEKRAR GIRINIZ.!");
break;
}
if (reno>enBuyuk) {
enBuyuk = reno;
}
if (mazda>enBuyuk) {
enBuyuk = mazda;
}
if (honda>enBuyuk) {
enBuyuk = honda;
}
if (ford>enBuyuk) {
enBuyuk = ford;
}
if (Treno>TenBuyuk) {
TenBuyuk = Treno;
}
if (Tmazda>TenBuyuk) {
TenBuyuk = Tmazda;
}
if (Thonda>TenBuyuk) {
TenBuyuk = Thonda;
}
if (Tford>TenBuyuk) {
TenBuyuk = Tford;
}
} while (aracKodu != 111);
System.err.println("\n\nPROGRAM SONA ERDI.\n\n");
System.err.println("OZET BILGILER");
if (reno==enBuyuk) {
System.out.println("En cok gelen arac markasi : Renault (" +enBuyuk+" kez)");
}
if (mazda==enBuyuk) {
System.out.println("En cok gelen arac markasi : Mazda ("+enBuyuk+" kez)");
}
if (honda==enBuyuk) {
System.out.println("En cok gelen arac markasi : Honda ("+enBuyuk+" kez)");
}
if (ford==enBuyuk) {
System.out.println("En cok gelen arac markasi : Ford ("+enBuyuk+" kez)");
}
if (Treno==TenBuyuk) {
System.out.println("En cok satis yapilan arac : Renault ("+TenBuyuk+" tl)");
}
if (Tford==TenBuyuk) {
System.out.println("En cok satis yapilan arac : Ford ("+TenBuyuk+" tl)");
}
if (Tmazda==TenBuyuk) {
System.out.println("En cok satis yapilan arac : Mazda ("+TenBuyuk+" tl)");
}
if (Thonda==TenBuyuk) {
System.out.println("En cok satis yapilan arac : Honda ("+TenBuyuk+" tl)");
}
}
}