PC
MARTIN CARHUAS HUACHO U21313255unknown
plain_text
3 years ago
4.3 kB
5
Indexable
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int cantidad, vuelo, destino; System.out.println("ALMUNNO; MARTIN CARHUAS H"); System.out.println("INGRESAR CANTIDAD DE PASAJES A CONSULTAR"); cantidad = scan.nextInt(); String[] VUELO = new String[cantidad]; String[] DESTINO = new String[cantidad]; int[] PASAJEROS = new int[cantidad]; double[] COSTO = new double[cantidad]; double[] BASE = new double[cantidad]; double[] DESCUENTO = new double[cantidad]; double[] TOTAL = new double[cantidad]; for (int x = 0; x < cantidad; x++) { System.out.println("***********************"); System.out.println(" REGISTRO N" + (x + 1)); System.out.println("************************"); System.out.println("INGRESAR VUELOS:"); System.out.println("[1] NACIONAL"); System.out.println("[2] INTERNACIONAL"); do { vuelo = scan.nextInt(); if (vuelo < 1 || vuelo > 2) { System.out.println("ERROR, VUELVA A INGRESAR EL VUELO"); } } while (vuelo < 1 || vuelo > 2); switch (vuelo) { case 1: VUELO[x] = "VUELOS NACIONALES"; System.out.println("INGRESE SU DESTINO"); System.out.println("[N1] LIMA ---> AREQUIPA S/180 "); System.out.println("[N2] LIMA ---> IQUITOS S/250 "); do { destino = scan.nextInt(); if (destino < 1 || destino > 2) { System.out.println("ERROR, VUELVA A INGRESAR DESTINO"); } } while (destino < 1 || destino > 2); switch (destino) { case 1: DESTINO[x] = "LIMA -> AREQUIPA"; COSTO[x] = 180; break; case 2: DESTINO[x] = "LIMA -> IQUITOS "; COSTO[x] = 250; break; } break; case 2: VUELO[x] = "VUELOS INTERNACIONAL"; System.out.println("INGRESAR DESTINO"); System.out.println("[I1] LIMA -> QATAR S/1500 "); System.out.println("[I2] LIMA -> VENEZUELA S/2000 "); do { destino = scan.nextInt(); if (destino < 1 || destino > 2) { System.out.println("ERROR, VUELVA A INGRESAR DESTINO"); } } while (destino < 1 || destino > 2); switch (destino) { case 1: DESTINO[x] = "LIMA -> QATAR "; COSTO[x] = 1500; break; case 2: DESTINO[x] = "LIMA -> VENEZUELA"; COSTO[x] = 2000; break; } break; } System.out.println("¿CUANTOS PASAJEROS?"); PASAJEROS[x] = scan.nextInt(); BASE[x] = PASAJEROS[x] * COSTO[x]; if (PASAJEROS[x] > 2 && vuelo == 2) { DESCUENTO[x] = BASE[x] * 0.10; } else { DESCUENTO[x] = 0; } TOTAL[x] = BASE[x] - DESCUENTO[x]; } System.out.println("----------------------------------------------------------------------------"); System.out.println("N\tVUELO\t\tDESTINO\t\tPASAJEROS\tCOSTO\tIMPORTE\tDESC.\tTOTAL"); for (int x = 0; x < cantidad; x++) { System.out.println((x + 1) + "\t" + VUELO[x] + "\t" + DESTINO[x] + "\t" + PASAJEROS[x] + "\t" + COSTO[x] + "\t" + BASE[x] + "\t" + DESCUENTO[x] + "\t" + TOTAL[x]); } } }
Editor is loading...