-
Lenguaje
Pascal
-
Descripción
Calcular la cuenta en una cevichería con las siguientes variables:
- Ceviche pequeño $3.50
- Ceviche grande $5.00
- Colas $0.50
- Porción de chifle $0.50
- Arroz $0.75
Iva de la cuenta.
Total de la cuenta.
La interfaz tiene que ser explicita para el consumidor explicando cada ingreso de forma clara que no confunda al usuario que va a usar el programa.
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
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
program Cevicheria;
uses crt;
var platillo : integer;
var IVA, cantidad_de_platillos, importe, precio, precio_del_platillo : real;
var subtotal, total : real;
var tecla_repetir : char;
begin
IVA := 0;
subtotal := 0;
total := 0;
repeat
clrscr;
write ('Ingresa el valor de cantidad de platillos: ');
readln (cantidad_de_platillos);
writeln ('Selecciona el valor de platillo.');
writeln (' 1.- Ceviche peque'#164'o');
writeln (' 2.- Ceviche grande');
writeln (' 3.- Colas');
writeln (' 4.- Porci'#162'n de chifle');
writeln (' 5.- Arroz');
write (' : ');
repeat
readln (platillo);
if (platillo<1) or (platillo>5) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (platillo>=1) and (platillo<=5);
precio_del_platillo := 0;
if platillo=1 then
begin
precio := 3.5;
end;
if platillo=2 then
begin
precio := 5;
end;
if platillo=3 then
begin
precio := 0.5;
end;
if platillo=4 then
begin
precio := 0.5;
end;
if platillo=5 then
begin
precio := 0.75;
end;
importe := precio_del_platillo*cantidad_de_platillos;
subtotal := subtotal+importe;
writeln ('Valor de importe: ', importe:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de precio del platillo: ', precio_del_platillo:0:6);
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
IVA := subtotal*0.16;
total := subtotal+IVA;
writeln ('Valor de IVA: ', IVA:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var platillo : integer;
var IVA, cantidad_de_platillos, importe, precio, precio_del_platillo : real;
var subtotal, total : real;
var tecla_repetir : char;
begin
IVA := 0;
subtotal := 0;
total := 0;
repeat
clrscr;
write ('Ingresa el valor de cantidad de platillos: ');
readln (cantidad_de_platillos);
writeln ('Selecciona el valor de platillo.');
writeln (' 1.- Ceviche peque'#164'o');
writeln (' 2.- Ceviche grande');
writeln (' 3.- Colas');
writeln (' 4.- Porci'#162'n de chifle');
writeln (' 5.- Arroz');
write (' : ');
repeat
readln (platillo);
if (platillo<1) or (platillo>5) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (platillo>=1) and (platillo<=5);
precio_del_platillo := 0;
if platillo=1 then
begin
precio := 3.5;
end;
if platillo=2 then
begin
precio := 5;
end;
if platillo=3 then
begin
precio := 0.5;
end;
if platillo=4 then
begin
precio := 0.5;
end;
if platillo=5 then
begin
precio := 0.75;
end;
importe := precio_del_platillo*cantidad_de_platillos;
subtotal := subtotal+importe;
writeln ('Valor de importe: ', importe:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de precio del platillo: ', precio_del_platillo:0:6);
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
IVA := subtotal*0.16;
total := subtotal+IVA;
writeln ('Valor de IVA: ', IVA:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.