-
Lenguaje
Java usando Scanner
-
Descripción
Permita calcular el total a pagar por un cliente en específico de un número intermedio de personas. De la venta de un día sabiendo que en un negocio de comida rápida de venta:
1. Pizza 2500bs
2. Hamburguesas 1300bs
3. Perros calientes 700bs
También se desea saber cuantas unidades se vendieron de cada comida, cuantas se vendieron en total del cierre del día, y determinar si el cliente compra más de dos pizza obtendra un descuento del 10 % de su compra.
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
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
import java.util.Scanner;
public class PizzasHamburguesasYPerrosCalientes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int descuento, hamburguesas, i, n, perros_calientes;
int pizzas, total_a_pagar, unidades_de_hamburguesas, unidades_de_perros_calientes, unidades_de_pizzas;
int unidades_en_total;
unidades_de_hamburguesas = 0;
unidades_de_perros_calientes = 0;
unidades_de_pizzas = 0;
unidades_en_total = 0;
System.out.print("Ingresa el valor de n: ");
n = in.nextInt();
in.nextLine();
for (i=1; i<=n; i++) {
System.out.print("PROCESO " + i);
System.out.print("Ingresa el valor de hamburguesas: ");
hamburguesas = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de perros calientes: ");
perros_calientes = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de pizzas: ");
pizzas = in.nextInt();
in.nextLine();
total_a_pagar=pizzas*2500+hamburguesas*1300+perros_calientes*700;
if(pizzas>2)
descuento=total_a_pagar*0.1;
else
descuento=0;
total_a_pagar=total_a_pagar-descuento;
unidades_de_pizzas=unidades_de_pizzas+pizzas;
unidades_de_hamburguesas=unidades_de_hamburguesas+hamburguesas;
unidades_de_perros_calientes=unidades_de_perros_calientes+perros_calientes;
unidades_en_total=unidades_en_total+pizzas+hamburguesas+perros_calientes;
System.out.println("Valor de descuento: " + descuento);
System.out.println("Valor de total a pagar: " + total_a_pagar);
System.out.println();
}
System.out.println("Valor de unidades de hamburguesas: " + unidades_de_hamburguesas);
System.out.println("Valor de unidades de perros calientes: " + unidades_de_perros_calientes);
System.out.println("Valor de unidades de pizzas: " + unidades_de_pizzas);
System.out.println("Valor de unidades en total: " + unidades_en_total);
}
}
public class PizzasHamburguesasYPerrosCalientes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int descuento, hamburguesas, i, n, perros_calientes;
int pizzas, total_a_pagar, unidades_de_hamburguesas, unidades_de_perros_calientes, unidades_de_pizzas;
int unidades_en_total;
unidades_de_hamburguesas = 0;
unidades_de_perros_calientes = 0;
unidades_de_pizzas = 0;
unidades_en_total = 0;
System.out.print("Ingresa el valor de n: ");
n = in.nextInt();
in.nextLine();
for (i=1; i<=n; i++) {
System.out.print("PROCESO " + i);
System.out.print("Ingresa el valor de hamburguesas: ");
hamburguesas = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de perros calientes: ");
perros_calientes = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de pizzas: ");
pizzas = in.nextInt();
in.nextLine();
total_a_pagar=pizzas*2500+hamburguesas*1300+perros_calientes*700;
if(pizzas>2)
descuento=total_a_pagar*0.1;
else
descuento=0;
total_a_pagar=total_a_pagar-descuento;
unidades_de_pizzas=unidades_de_pizzas+pizzas;
unidades_de_hamburguesas=unidades_de_hamburguesas+hamburguesas;
unidades_de_perros_calientes=unidades_de_perros_calientes+perros_calientes;
unidades_en_total=unidades_en_total+pizzas+hamburguesas+perros_calientes;
System.out.println("Valor de descuento: " + descuento);
System.out.println("Valor de total a pagar: " + total_a_pagar);
System.out.println();
}
System.out.println("Valor de unidades de hamburguesas: " + unidades_de_hamburguesas);
System.out.println("Valor de unidades de perros calientes: " + unidades_de_perros_calientes);
System.out.println("Valor de unidades de pizzas: " + unidades_de_pizzas);
System.out.println("Valor de unidades en total: " + unidades_en_total);
}
}