-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalisanGorevOtomasyonu.java
131 lines (93 loc) · 2.93 KB
/
CalisanGorevOtomasyonu.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
124
125
126
127
128
129
130
131
// CLASS CALISAN
public abstract class Calisan_1887 {
public int id;
public String ad;
public String soyad;
public int yas;
public int cs;
private static int sayac = 998;
public Calisan_1887(String ad, String soyad, int yas, int cs) {
this.id = sayac + 2;
this.ad = ad;
this.soyad = soyad;
this.yas = yas;
this.cs = cs;
}
public abstract double ZamOraniHesapla();
}
// CLASS ISCI
public class Isci_1887 extends Calisan_1887 implements Maas_1887 {
public String gorev;
public Isci_1887(String ad, String soyad, int yas, int cs, String gorev) {
super(ad, soyad, yas, cs);
this.gorev = "Isci";
}
@Override
public double MaasHesapla() {
double maas = ZamOraniHesapla();
maas += 3000.0;
return maas;
}
@Override
public double ZamOraniHesapla() {
double zam = 0.0;
zam += ((double)cs * 100) + ((yas * ((double)2/3)));
return zam;
}
}
// INTERFACE
public interface Maas_1887 {
public abstract double MaasHesapla();
}
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
// CLASS ANASAYFA
public class Anasayfa_1887 {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
int is;
System.out.println("Kac isci bilgisi gireceksiniz : ");
is = scanner.nextInt();
ArrayList<Isci_1887> isciler = new ArrayList<Isci_1887>();
String ad, soyad, gorev;
int yas, cs;
for(int i=0; i<is; i++)
{
System.out.println("Isci ad giriniz : ");
ad = scanner.next();
System.out.println("Isci soyad giriniz : ");
soyad = scanner.next();
System.out.println("Isci gorev giriniz : ");
gorev = scanner.next();
System.out.println("Isci yas giriniz : ");
yas = scanner.nextInt();
System.out.println("Isci cs giriniz : ");
cs = scanner.nextInt();
Isci_1887 isci = new Isci_1887(ad, soyad, yas, cs, gorev);
isciler.add(isci);
System.out.println("\n -------------------------- \n");
}
System.out.println("\n\t -- Tum Isciler ve Bilgileri -- \n");
for(Isci_1887 i : isciler)
{
System.out.println("Isci id : " + i.id + "\nIsci ad : " + i.ad + "\nIsci soyad : " + i.soyad + "\nIsci gorev : " + i.gorev + "\nIsci yas : " + i.yas + "\nIsci cs : " + i.cs + "\nIsci maas : " + i.MaasHesapla());
System.out.println("---------------------------------------------------");
}
File file = new File("isciler.txt");
FileWriter fw = new FileWriter(file, true);
BufferedWriter bw = new BufferedWriter(fw);
if(!file.exists())
{
file.createNewFile();
}
for(Isci_1887 isci : isciler)
{
bw.write(isci.id + " " + isci.ad + " " + isci.soyad + " " + isci.gorev + " " + isci.yas + " " + isci.cs + " " + isci.MaasHesapla() +"\n");
}
bw.close();
}
}