Error al inicializar las variables
Publicado por nick (4 intervenciones) el 20/04/2013 06:05:07
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import java.io.*;
public class Ejercicio15{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
char cat,rpta,f1,afp1;
String categ,afp,turn,falta;
double pago1,descf,descaf,horas,bon,pagot,nfalt;
System.out.print("¿Es trabajador contratado o estable?");
categ = br.readLine();
categ = categ.toUpperCase();
cat = categ.charAt(0);
//categorias de trabajo
if (cat=='C' || cat=='E'){
// categoria contratada
if (cat=='C'){
//pago por horas
System.out.print("Ingrese la horas trabajadas: ");
horas = Double.parseDouble(br.readLine());
pago1 = 12*horas;
//turnos de noche
System.out.print("¿Ha realizado turno de noche?(SI/NO)");
turn = br.readLine();
turn = turn.toUpperCase();
rpta = turn.charAt(0);
if (rpta=='S' || rpta=='N'){
if (rpta=='S'){
bon = pago1*0.1;
}
else{
if (rpta=='N'){
bon = 0;
}
}
}
else
System.out.print("ERROR EN DATOS!");
//Faltas
System.out.print("¿Ha tenido faltas?(SI/NO)");
falta = br.readLine();
falta = falta.toUpperCase();
f1 = falta.charAt(0);
if (f1=='S' || f1=='N'){
if (f1=='S'){
System.out.print("¿Cuantas faltas tuvo?");
nfalt = Double.parseDouble(br.readLine());
descf = nfalt *20;
}
if (f1 =='N'){
descf=0;
}
}
else
System.out.print("ERROR EN DATOS!");
//PAGO TOTAL
pagot = (pago1+bon)-descf;
//AFP
System.out.print("¿Esta afiliado a la AFP?(SI/NO)");
afp =br.readLine();
afp = afp.toUpperCase();
afp1 = afp.charAt(0);
if (afp1=='S' || afp1 =='N'){
if (afp1=='S'){
descaf = pagot * 0.11;
}
else
if (afp1=='N'){
descaf=0;
}
}
else
System.out.print("ERROR EN DATOS!");
System.out.print("Se le paga : " + pago1 +"\n Por turno de noche se le paga: " + bon
+ "\n Por las faltas se le descuenta: " + descf +"\n Por el AFP se le descuenta: S/." + descaf );
}
else{
if (cat =='E'){
//pago por horas
System.out.print("Ingrese la horas trabajadas: ");
horas = Double.parseDouble(br.readLine());
pago1 = 10*horas;
//turnos de noche
System.out.print("¿Ha realizado turno de noche?(SI/NO)");
turn = br.readLine();
turn = turn.toUpperCase();
rpta = turn.charAt(0);
if (rpta=='S' || rpta=='N'){
if (rpta=='S'){
bon = pago1*0.1;
}
else{
if (rpta=='N'){
bon = 0;
}
}
}
else
System.out.print("ERROR EN DATOS!");
//Faltas
System.out.print("¿Ha tenido faltas?(SI/NO)");
falta = br.readLine();
falta = falta.toUpperCase();
f1 = falta.charAt(0);
if (f1=='S' || f1=='N'){
if (f1=='S'){
System.out.print("¿Cuantas faltas tuvo?");
nfalt = Double.parseDouble(br.readLine());
descf = nfalt *20;
}
else{
if (f1 =='N'){
descf=0;
}
}
}
else
System.out.print("ERROR EN DATOS!");
//PAGO TOTAL
pagot = pago1+bon-descf;
//AFP
System.out.print("¿Esta afiliado a la AFP?(SI/NO)");
afp =br.readLine();
afp = afp.toUpperCase();
afp1 = afp.charAt(0);
if (afp1=='S' || afp1 =='N'){
if (afp1=='S'){
descaf = pagot * 0.11;
}
else
if (afp1=='N'){
descaf=0;
}
}
else{
System.out.print("ERROR EN DATOS!");
}
}
else
System.out.print("ERROR EN DATOS!");
}
System.out.print("Se le paga : " + pago1 +"\n Por turno de noche se le paga: " + bon
+ "\n Por las faltas se le descuenta: " + descf +"\n Por el AFP se le descuenta: S/." + descaf );
}
else
System.out.print("ERROR EN DATOS!");
}
}
Valora esta pregunta


0