-
Lenguaje
Java usando Scanner
-
Descripción
Lea la cantidad de clientes y la cantidad de artículos que cada cliente compró y calcules el total de ventas. Los artículos son los que se muestran en la tabla.
Artículos
Precio | unitario
Cuaderno | $35.00
Lápiz | $2.00
Bolígrafo | $5.50
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
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
import java.util.Scanner;
public class VentaDeCuadernosLapicesYBoligrafos {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i, n;
double cantidad_de_boligrafos, cantidad_de_cuadernos, cantidad_de_lapices, total_de_ventas, venta;
total_de_ventas = 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 cantidad de boligrafos: ");
cantidad_de_boligrafos = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de cantidad de cuadernos: ");
cantidad_de_cuadernos = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de cantidad de lapices: ");
cantidad_de_lapices = in.nextDouble();
in.nextLine();
venta=35.0*cantidad_de_cuadernos+2.0*cantidad_de_lapices+5.5*cantidad_de_boligrafos;
total_de_ventas=total_de_ventas+venta;
System.out.println("Valor de venta: " + venta);
System.out.println();
}
System.out.println("Valor de total de ventas: " + total_de_ventas);
}
}
public class VentaDeCuadernosLapicesYBoligrafos {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i, n;
double cantidad_de_boligrafos, cantidad_de_cuadernos, cantidad_de_lapices, total_de_ventas, venta;
total_de_ventas = 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 cantidad de boligrafos: ");
cantidad_de_boligrafos = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de cantidad de cuadernos: ");
cantidad_de_cuadernos = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de cantidad de lapices: ");
cantidad_de_lapices = in.nextDouble();
in.nextLine();
venta=35.0*cantidad_de_cuadernos+2.0*cantidad_de_lapices+5.5*cantidad_de_boligrafos;
total_de_ventas=total_de_ventas+venta;
System.out.println("Valor de venta: " + venta);
System.out.println();
}
System.out.println("Valor de total de ventas: " + total_de_ventas);
}
}