Você está na página 1de 10

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1. Determinar​ ​si​ ​un​ ​alumno​ ​está​ ​aprobado​ ​o​ ​reprobado​ ​en​ ​la​ ​clase​ ​de
Programación​ ​I.

Proceso:

Inicio
Variable:​ ​N
Mostrar:​ ​“Ingrese​ ​nota​ ​promedio”
Lee:​ ​N
Si​ ​N>=60​ ​Entonces
Mostrar​ ​“Aprueba”
de​ ​lo​ ​contrario
Mostrar​ ​“Reprueba”
Fin
Prueba​ ​de​ ​Escritorio

Nota Resultado
10+50=60 Aprobado
20+60=80 Aprobado
10+30=40 Reprobado
10+10=20 Reprobado

CODIGO​ ​JAVA
package​ ​alumnos.aprobados.y.reprobados;
import​ ​java.util.Scanner;
public​ ​class​ ​AlumnosAprobadosYReprobados​ ​{
public​ ​static​ ​void​ ​main(String[]​ ​args)​ ​{
int​ ​Periodo1;
int​ ​Periodo2;
int​ ​Total;
​ ​ ​ ​ ​Scanner​ ​teclado=new​ ​Scanner(System.in);
​ ​ ​ ​ ​ ​ ​ ​System.out.println("Ingrese​ ​Nota​ ​1​ ​Periodo");
​ ​ ​ ​ ​ ​ ​ ​Periodo1=teclado.nextInt(​ ​);
​ ​ ​ ​ ​ ​ ​ ​System.out.println("Ingrese​ ​Nota​ ​2​ ​Periodo");
​ ​ ​ ​ ​ ​ ​ ​Periodo2=teclado.nextInt(​ ​);
​ ​ ​ ​ ​Total=Periodo1+Periodo2;
​ ​ ​ ​ ​if​ ​(Total>=60){
​ ​ ​ ​ ​ ​ ​ ​System.out.println("Alumno​ ​Aprobado");
​ ​ ​ ​ ​}
​ ​ ​ ​ ​else​ ​if​ ​(Total<=59){
​ ​ ​ ​ ​ ​ ​ ​System.out.println("Alumno​ ​Reprobado");
​ ​ ​ ​ ​}
​ ​ ​ ​ ​}
}

2. Desarrollar​ ​una​ ​prueba​ ​de​ ​escritorio​ ​que​ ​haga​ ​la​ ​sumade3​ ​números.

Proceso

Inicio
Variable:​ ​a,​ ​b,​ ​c,​ ​d
Mostrar:​ ​“Ingrese​ ​a”
Lee:​ ​a
Mostrar:​ ​“Ingrese​ ​b”
Lee:​ ​b
Mostrar:​ ​“Ingrese​ ​c”
Lee:​ ​c
d=​ ​a+b+c
Mostrar:​ ​“Resultado​ ​de​ ​la​ ​suma​ ​es”
Fin
Prueba​ ​de​ ​Escritorio
a b c Resultado
12 6 6 24
9 3 10 22
4 6 9 19
5 6 7 18

Código​ ​Java

package​ ​suma.de.tres.numeros;
import​ ​java.util.Scanner;
public​ ​class​ ​SumaDeTresNumeros​ ​{
​ ​ ​ ​ ​public​ ​static​ ​void​ ​main(String[]​ ​args)​ ​{
​ ​ ​ ​ ​ ​ ​ ​ ​int​ ​a;
​ ​ ​ ​ ​ ​ ​ ​ ​int​ ​b;
​ ​ ​ ​ ​ ​ ​ ​ ​int​ ​c;
​ ​ ​ ​ ​ ​ ​ ​ ​int​ ​d;
​ ​ ​ ​ ​ ​ ​ ​ ​Scanner​ ​teclado=new​ ​Scanner​ ​(System.in);
​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Ingrese​ ​primer​ ​numero");
​ ​ ​ ​ ​ ​ ​ ​ ​ ​a=teclado.nextInt();
​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Ingrese​ ​segundo​ ​numero");
​ ​ ​ ​ ​ ​ ​ ​ ​ ​b=teclado.nextInt();
​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Ingrese​ ​tercer​ ​numero");
​ ​ ​ ​ ​ ​ ​ ​ ​ ​c=teclado.nextInt();
​ ​ ​ ​ ​ ​ ​ ​ ​d=a+b+c;
​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("El​ ​resultado​ ​de​ ​la​ ​suma​ ​es");
​ ​ ​ ​ ​ ​ ​ ​ ​System.out.print(d);
​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("");
​ ​ ​ ​ ​}
}

3. Determine​ ​si​ ​un​ ​número​ ​es​ ​par​ ​o​ ​impar.

Proceso

Inicio
Variable:​ ​a,​ ​b
Mostrar:​ ​“Ingrese​ ​a”
Lee:​ ​a
Si​ ​a%2=0​ ​Entonces
Mostrar:​ ​“Numero​ ​es​ ​par”
de​ ​lo​ ​contrario
Si​ ​a%2!=0​ ​Entonces
Mostrar:​ ​“Numero​ ​es​ ​impar”
Fin

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​No​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​Si
Prueba​ ​de​ ​Escritorio

a b Resultado
4 2 Par
3 2 Impar
5 2 Impar
6 2 Par

Código​ ​Java
package​ ​numeros.pares.e.impares;

import​ ​java.util.*;

public​ ​class​ ​NumerosParesEImpares​ ​{

​ ​ ​ ​ ​public​ ​static​ ​void​ ​main(String[]​ ​args)​ ​{

​ ​ ​ ​ ​ ​ ​ ​ ​int​ ​a;

​ ​ ​ ​ ​ ​ ​ ​ ​Scanner​ ​sc=new​ ​Scanner(System.in);

​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Introduce​ ​un​ ​numero");

​ ​ ​ ​ ​ ​ ​ ​ ​int​ ​resultado=sc.nextInt();

​ ​ ​ ​ ​ ​ ​ ​ ​a=resultado;

​ ​ ​ ​ ​ ​ ​ ​ ​if​ ​(a​ ​%​ ​2==0​ ​)

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Es​ ​par");

​ ​ ​ ​ ​ ​ ​ ​ ​else

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Es​ ​impar");

​ ​ ​ ​ ​}

}
4. Calcular​ ​el​ ​impuesto​ ​de​ ​Hamburguesas​ ​en​ ​la​ ​cafetería​ ​de​ ​CEUTEC
con​ ​un​ ​costo​ ​mayor​ ​de​ ​L30.0

Proceso

Inicio
Variable:​ ​Precio
Mostrar:​ ​“Ingrese​ ​Precio”
Lee:​ ​Precio
Si​ ​Precio>=30​ ​Entonces
Mostrar​ ​”Total​ ​+​ ​ISV”
de​ ​lo​ ​contrario​ ​ ​Precio<=29​ ​Entonces
Mostrar​ ​”Total​ ​sin​ ​ISV”
Fin

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​NO​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​SI
Prueba​ ​de​ ​Escritorio
Precio ISV Total
30 √ L34.5
25 ----- L25.0
100 √ L115.0
10 ----- L10.0
1000 √ L1150.0

Código​ ​Java
package​ ​impuesto.hamburguesa;

import​ ​java.util.Scanner;

public​ ​class​ ​ImpuestoHamburguesa​ ​{

​ ​ ​ ​ ​public​ ​static​ ​void​ ​main(String[]​ ​args)​ ​{

​ ​ ​ ​ ​ ​ ​ ​ ​double​ ​precio;

​ ​ ​ ​ ​ ​ ​ ​ ​double​ ​presupuesto;

​ ​ ​ ​ ​ ​ ​ ​ ​double​ ​total1;

​ ​ ​ ​ ​ ​ ​ ​ ​double​ ​total2;

​ ​ ​ ​ ​ ​ ​ ​ ​Scanner​ ​teclado=new​ ​Scanner​ ​(System.in);

​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Ingrese​ ​precio");

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​precio=teclado.nextInt();

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​presupuesto​ ​=​ ​0.15;

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​total1=precio*presupuesto;

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​total2=precio+total1;

​ ​ ​ ​ ​ ​ ​ ​ ​if​ ​(precio>=30){
​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Total​ ​+​ ​ISV");

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println(total2);

​ ​ ​ ​ ​ ​ ​ ​ ​}

​ ​ ​ ​ ​ ​ ​ ​ ​else​ ​if​ ​(precio<=29){

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println("Total​ ​sin​ ​ISV");

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​System.out.println(precio);

​ ​ ​ ​ ​ ​ ​ ​ ​}

​ ​ ​ ​ ​ ​ ​ ​ ​}

​ ​ ​ ​ ​}

Você também pode gostar