0% found this document useful (0 votes)
31 views7 pages

Alcántara Alvarado Jean Pierre 1623225648

This document contains 5 Java programs that calculate totals for different scenarios. Each program takes user input, performs calculations based on conditions, and outputs the payment or cost per item and the total. The programs calculate totals for hamburgers ordered, bus fares based on distance and passengers, tuition costs based on number of students, and medical appointment fees based on number of visits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views7 pages

Alcántara Alvarado Jean Pierre 1623225648

This document contains 5 Java programs that calculate totals for different scenarios. Each program takes user input, performs calculations based on conditions, and outputs the payment or cost per item and the total. The programs calculate totals for hamburgers ordered, bus fares based on distance and passengers, tuition costs based on number of students, and medical appointment fees based on number of visits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

UNIVERSIDAD NACIONAL DEL CALLAO

FACULTAD DE INGENIERÍA ELÉCTRICA Y ELECTRÓNICA

ESCUELA PROFESIONAL DE INGENIERÍA ELECTRÓNICA

CURSO: Programación Avanzada

EXPERIENCIA: Lab4

PROFESOR: Dr. Mendoza Apaza Fernando

ESTUDIANTE: CODIGO:
Alcántara Alvarado Jean Pierre 1623225648

FECHA:

12/ 09 /2019

GRUPO HORARIO: 90-G

HORA:

05:10 p.m. – 06:50 p.m.

2019
Parte 1
1.
package curso;
import java.util.Scanner;
public class NewClass1 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
Scanner entrada1=new Scanner(System.in);
int N=0;
String TI,TP;
double PA=0,CA=0,TO,TOT;
System.out.print("Numero de Hamburguesas :");
N=entrada.nextInt();
System.out.print("Tipo de Hamburguesa :\n");
System.out.print("[A] Sencilla:\n");
System.out.print("[B] Doble :\n");
System.out.print("[C] Triple :\n");
TI=entrada1.nextLine();
System.out.print("Tipo de pago :\n");
System.out.print("[A] Efectivo\n");
System.out.print("[B] Tarjeta\n");
TP=entrada1.nextLine();
switch(TI) {
case "A":
PA=20;
break;
case "B":
PA=25;
break;
case "C":
PA=28;
break;}
TO=PA*N;
switch(TP) {
case "A":
CA=0;
break;
case "B":
CA=0.05*TO;}
TOT=TO+CA;
System.out.print("Total $"+TOT+"\n");
}
}
2.
package curso;
import java.util.Scanner;
public class NewClass1 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
Scanner entrada1=new Scanner(System.in);
int TI=0;
String DI,TU;
double PAG=0,IMP=0,TOT=0;
System.out.print("Tiempo :");
TI=entrada.nextInt();
if(TI<=5){PAG=TI*1;}
if((TI>5)&&(TI<9)){PAG=TI*80;}
if((TI>=9)&&(TI<=10)){PAG=TI*70;}
if(TI>10){PAG=TI*50;}
System.out.print("Tipo de Dia :\n");
System.out.print("[A] Domingo \n");
System.out.print("[B] Dia Habil\n");
DI=entrada1.nextLine();
switch(DI) {
case "A":
IMP=0.03*PAG;
break;
case "B":
System.out.print("Turno :\n");
System.out.print("[A] Turno Matutino \n");
System.out.print("[B] Turno Vespertino \n");
TU=entrada1.nextLine();
switch(TU) {
case "A":
IMP=0.15*PAG;
break;
case "B":
IMP=0.1*PAG;
break;}}
TOT=PAG+IMP;
System.out.print("Total $"+TOT+"\n");
}
}
3.
package curso;
import java.util.Scanner;
public class NewClass1 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
Scanner entrada1=new Scanner(System.in);
int KM=0,NPR=0,NP=0;
String TI;
double CK=0,CP=0,TO=0;
System.out.print("Tipo de Autobus :\n");
System.out.print("[A] $2.00 \n");
System.out.print("[B] $2.50 \n");
System.out.print("[C] $3.00 \n");
TI=entrada1.nextLine();
System.out.print("KM :\n");
KM=entrada.nextInt();
System.out.print("NRO DE PERSONAS REAL: \n");
NPR=entrada.nextInt();
switch(TI) {
case "A":
CK=2;
break;
case "B":
CK=2.5;
break;
case "C":
CK=3;
break;}
if(NPR>=20){NP=0;CP=CK*KM;TO=CP*NPR;}
if(NPR<20){NP=20-NPR;CP=CK*KM;TO=CP*20;}
System.out.print("Costo por persona $"+CP+"\n");
System.out.print("Total $"+TO+"\n");
}
}
4.
package curso;
import java.util.Scanner;
public class NewClass1 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
Scanner entrada1=new Scanner(System.in);
int NA=0,CR=4000;
double PA=0,TOT=0;
System.out.print("Numero de Alumnos :\n");
NA=entrada.nextInt();
if(NA>=100){PA=65;}
if((NA>=50)&&(NA<100)){PA=70;}
if((NA>=30)&&(NA<50)){PA=95;}
if(NA<30){PA=CR/NA;}
TOT=NA*PA;
System.out.print("Pago por alumno $"+PA+"\n");
System.out.print("Total $"+TOT+"\n");
}
}
5.
package curso;
import java.util.Scanner;
public class NewClass1 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int NC=0;
double CC=0,TOT=0;
System.out.print("Numero de citas :\n");
NC=entrada.nextInt();
if(NC>8){CC=50;}
if((NC>5)&&(NC<=8)){CC=100;}
if((NC>3)&&(NC<=5)){CC=150;}
if(NC<=3){CC=200;}
TOT=NC*CC;
System.out.print("Pago por cita $"+CC+"\n");
System.out.print("Total $"+TOT+"\n");
}
}

You might also like