You are on page 1of 7

EXAMEN FINAL DE ALGORITMICA 1

 DOCENTE: Contreras Flores Walter


 ESTUDIANTE: Aparicio Rojo Cristian Gustavo
 FECHA: 09/12/2019
 CODIGO: 2019100134

1. EJERCICIO 1:

package pregunta01;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Pregunta01 {
public static float area,l,a,Total,p;
public static void menu(){
System.out.println("\nCOLEGIO DE PAPÁ");
System.out.println("*****************");
System.out.println("TIPOS DE ACCESORIOS");
System.out.println("(P)ORCELANATO");
System.out.println("(C)ERÁMICO");
System.out.println("(T)ERMINAR");
System.out.println("\nELIJA OPCIÓN");
}
public static float dato(){

Scanner dato=new Scanner(System.in);

System.out.println("INGRESE LARGO");
l=dato.nextFloat();
System.out.println("INGRESE ANCHO");
a=dato.nextFloat();
System.out.println("INGRESE PRECIO DE PRODUCTO");
p=dato.nextFloat();

return l*a*p;
}
public static float calcular(float l,float a, float p){
return l*a*p;
}
@SuppressWarnings("fallthrough")
public static void main(String[] args) {
String opc = null;
int x=1;
float inv;
byte[] texto=new byte[20];
byte w ='T',wy;
Scanner valor=new Scanner (System.in);
while (x==1){
menu();
opc=JOptionPane.showInputDialog(null,"ELIJA UNA OPCIÓN");
System.out.println(""+opc+"\n");
texto=opc.getBytes();
wy=texto[0];
switch(wy)
{
case 'p':
case 'P': dato();
inv=calcular(l,a,p);
System.out.println("LA INVERSIÓN A REALIZAR ES "+inv);
break;
case 'c':
case 'C': dato();
inv=calcular(l,a,p);
System.out.println("LA INVERSIÓN A REALIZAR ES "+inv);
break;
case 't':
case 'T': x=0;
System.out.println("GRACIAS POR USAR EL PROGRAMA, HASTA
LUEGO");
default: System.out.println("Opción no válida");
}
}
}

2. EJERCICIO 2:

package pregunta02;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Pregunta02 {
public static float area,l,a,Total,p,can;
public static void menu(){
System.out.println("\nCASA DE JHON");
System.out.println("******************************");
System.out.println("TIPOS DE CEMENTO");
System.out.println("(I)NKA");
System.out.println("(A)NDINO");
System.out.println("(S)ALIR");
System.out.println("\nELIJA OPCIÓN");
}
public static float dato(){

Scanner dato=new Scanner(System.in);

System.out.println("INGRESE LARGO");
l=dato.nextFloat();
System.out.println("INGRESE ANCHO");
a=dato.nextFloat();
System.out.println("INGRESE PRECIO DE CEMENTO (Alcanza m^2)");
p=dato.nextFloat();

return l*a*p;
}
public static float calcular(float l,float a, float p){
return (l*a/4)*p;
}
@SuppressWarnings("fallthrough")
public static void main(String[] args) {
String opc = null;
int x=1;
float inv;
byte[] texto=new byte[20];
byte w ='T',wy;
Scanner valor=new Scanner (System.in);
while (x==1){
menu();
opc=JOptionPane.showInputDialog(null,"ELIJA OPCIÓN");
System.out.println(""+opc+"\n");
texto=opc.getBytes();
wy=texto[0];
switch(wy)
{
case 'i':
case 'I': dato();
inv=calcular(l,a,p);
System.out.println("LA INVERSIÓN QUE REALIZARA SERA "+inv);
break;
case 'a':
case 'A': dato();
inv=calcular(l,a,p);
System.out.println("LA INVERSIÓN QUE REALIZARA SERA "+inv);
break;
case 's':
case 'S': x=0;
System.out.println("GRACIAS POR USAR EL PROGRAMA, HASTA
LUEGO");
default: System.out.println("Opción no válida");
}
}
}

}
3. EJERCICIO 3:

package pregunta03;
import java.util.Scanner;
import javax.swing.JOptionPane;

public class Pregunta03 {


public static float c,p,can;
public static void menu(){
System.out.println("\nFELIZ NAVIDAD A.H::MI PERÚ::");
System.out.println("******************************");
System.out.println("DONACION:: TIPOS DE POLO");
System.out.println("(G)AMUZA");
System.out.println("(J)ERSEY");
System.out.println("(S)ALIR");
System.out.println("\nELIJA OPCIÓN");
}
public static float dato(){
Scanner dato=new Scanner(System.in);
System.out.println("INGRESE CANTIDAD DE POLOS");
c=dato.nextFloat();
System.out.println("INGRESE PRECIO DE POLO");
p=dato.nextFloat();
if (c>0&&c<=250){
can=c*p;
}else {
System.out.println("SOLO DEBE INGRESAR NUMERO MAYOR QUE 0 Y
MENOR QUE 250");
}

return can;
}
public static float calcular(float can){
return can;
}
@SuppressWarnings("fallthrough")
public static void main(String[] args) {
String opc = null;
int x=1;
float inv;
byte[] texto=new byte[20];
byte w ='T',wy;
Scanner valor=new Scanner (System.in);
while (x==1){
menu();
opc=JOptionPane.showInputDialog(null,"ELIJA UNA OPCIÓN");
System.out.println(""+opc+"\n");
texto=opc.getBytes();
wy=texto[0];
switch(wy)
{
case 'g':
case 'G': dato();
inv=calcular(can);
System.out.println("LA INVERSIÓN QUE REALIZARA SERA "+inv);
break;
case 'j':
case 'J': dato();
inv=calcular(can);
System.out.println("LA INVERSIÓN QUE REALIZARA SERA "+inv);
break;
case 's':
case 'S': x=0;
System.out.println("GRACIAS POR USAR NUESTRO PROGAMA, VUELVA
PRONTO");
default: System.out.println("Opción no válida");
}
}
}

}
4. EJERCICIO 4:

package pregunta04;
import java.util.Scanner;
import javax.swing.JOptionPane;

public class Pregunta04 {

public static float c,p,can;


public static void menu(){
System.out.println("\nUNIVERCIDAD CATOLICA SEDES SAPIENTAE:
REAGALARA PANETONES");

System.out.println("***********************************************************
");
System.out.println("TIPOS DE PANETONES");
System.out.println("(D)ONOFRIO");
System.out.println("(S)ANTA CLARA");
System.out.println("(E)XIT");
System.out.println("\nELIJA OPCIÓN");
}
public static float dato(){
Scanner dato=new Scanner(System.in);
System.out.println("INGRESE CANTIDAD DE PANETONES");
c=dato.nextFloat();
System.out.println("INGRESE PRECIO DE PANETON");
p=dato.nextFloat();
if (c>0&&c<=750){
can=c*p;
}else {
System.out.println("CANTIDAD MAXIMA 750");
}
return can;

}
public static float calcular(float can){
return can;
}
public static void main(String[] args) {
String opc = null;
int x=1;
float inv;
byte[] texto=new byte[20];
byte w ='T',wy;
Scanner valor=new Scanner (System.in);
while (x==1){
menu();
opc=JOptionPane.showInputDialog(null,"ELIJA UNA OPCIÓN");
System.out.println(""+opc+"\n");
texto=opc.getBytes();
wy=texto[0];
switch(wy)
{
case 'd':
case 'D': dato();
inv=calcular(can);
System.out.println("LA INVERSIÓN A REALIZAR ES "+inv);
break;
case 's':
case 'S': dato();
inv=calcular(can);
System.out.println("LA INVERSIÓN A REALIZAR ES "+inv);
break;
case 'e':
case 'E': x=0;
System.out.println("GRACIAS POR USARME, VULVA PRONTO");
default: System.out.println("Opción no válida");
}
}
}
}

5. EJERCICIO 5:

package pregunta05;
import java.util.Scanner;
import javax.swing.JOptionPane;

public class Pregunta05 {

public static float c,p,can;


public static void menu(){
System.out.println("\nCAMBIO DE LLANTAS DE MI AUTO");
System.out.println("******************************");
System.out.println("TIPOS DE LLANTAS");
System.out.println("(G)oodyear");
System.out.println("(B)ridgestone");
System.out.println("(S)ALIR");
System.out.println("\nELIJA OPCIÓN");
}
public static float dato(){
Scanner dato=new Scanner(System.in);
System.out.println("INGRESE CANTIDAD DE LLANTAS");
c=dato.nextFloat();
System.out.println("INGRESE PRECIO DE LLANTAS");
p=dato.nextFloat();

return c*p;
}
public static float calcular(float c,float p){
return c*p;
}
@SuppressWarnings("fallthrough")
public static void main(String[] args) {
String opc = null;
int x=1;
float inv;
byte[] texto=new byte[20];
byte w ='T',wy;
Scanner valor=new Scanner (System.in);
while (x==1){
menu();
opc=JOptionPane.showInputDialog(null,"ELIJA OPCIÓN");
System.out.println(""+opc+"\n");
texto=opc.getBytes();
wy=texto[0];
switch(wy)
{
case 'g':
case 'G': dato();
inv=calcular(c,p);
System.out.println("LA INVERSIÓN A REALIZAR ES "+inv);
break;
case 'b':
case 'B': dato();
inv=calcular(c,p);
System.out.println("LA INVERSIÓN A REALIZAR ES "+inv);
break;
case 's':
case 'S': x=0;
System.out.println("GRACIAS POR ESTAR AQUI, GOOD BAY");
default: System.out.println("Opción no válida");
}
}
}
}

You might also like