Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Duda01 {
- public static void main(String[] args) {
- boolean mayor, sobrio;
- Scanner xr = new Scanner(System.in);
- System.out.println("Ingresa tu edad");
- int edad = xr.nextInt();
- System.out.println("Ingresa tu grado de alcohol");
- int grado = xr.nextInt();
- if(edad>17){
- mayor = true;
- }else {
- mayor = false;
- }
- if(grado>17){
- sobrio = false;
- }else{
- sobrio = true;
- }
- if(mayor && sobrio){
- System.out.println("Puede entrar");
- }else if(!mayor && !sobrio){
- System.out.println("Está ebrio y es menor de edad");
- }else if(!mayor){
- System.out.println("Es menor de edad");
- }else if(!sobrio){
- System.out.println("Esta ebrio");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement