Академический Документы
Профессиональный Документы
Культура Документы
Sino
{
Escribir ERROR;
}
}
}
}
FIN
Cdigo en Java
import javax.swing.JOptionPane;
public class ESTADOCIVIL {
public static void main(String[] args) {
int c;
c= Integer.parseInt(JOptionPane.showInputDialog("Ingrese un nmero del 1 al 4"));
if (c==1)
System.out.println("Soltero");
else
{
if (c==2)
System.out.println("Casado");
else
if(c==3)
System.out.println("Viudo");
else
if(c==4)
System.out.println("Divorciado");
else
System.out.println("ERROR");
}
}
}
Cdigo en Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
double d,monto,s;
System.out.println("Ingresa sueldo");
s=sc.nextDouble();
if(s>2000){
d=100+(s-1000)*0.03;
monto=s-d;
}else{
if(s>1000 && s<=2000){
d=100+(s-1000)*0.05;
monto=s-d;
}else{
d=s*0.1;
monto=s-d;
}
}
System.out.println( "El sueldo percibido es " +
monto + " y su descuento fue " + d);
}
}
Solucin
Cdigo en Java
import javax.swing.JOptionPane;
public class MESYDIASDELAO {
public static void main(String[] args) {
int mes ;
int ao=2013;
mes= Integer.parseInt(JOptionPane.showInputDialog("Ingrese el nmero del 1 al 12"));
switch(mes)
{
case 1: System.out.println( "ENERO"+",tiene 31 dias"); break;
case 3: System.out.println( "MARZO"+",tiene 31 dias"); break;
case 5: System.out.println( "MAYO"+",tiene 31 dias"); break;
case 7: System.out.println( "JULIO"+",tiene 31 dias"); break;
case 8: System.out.println( "AGOSTO"+",tiene 31 dias"); break;
case 10: System.out.println( "OCTUBRE"+",tiene 31 dias"); break;
case 12: System.out.println( "DICIEMBRE"+",tiene 31 dias"); break;
case 2:
if
default: System.out.println( "ERROR, solo ingresar un nmero del 1 al 12, que representan
a los meses del aos");
}
}
}