Ya estoy inscrito ¿Todavía no tienes acceso? Nuestros Planes
Ya estoy inscrito ¿Todavía no tienes acceso? Nuestros Planes
1
respuesta

Software "¿Tienes licencia para conducir?" -Primera iteración-😀

Hola compañeros y compañeras!:D

Comparto mi propuesta de la solución, cambié un poco la lógica del programa, hice que todo dependiera de su edad y de acuerdo al caso agregué una imagen acorde al contexto. Si cumple con el requisito de edad y tiene licencia para conducir aparece un hombre feliz que sigue conduciendo, si cumple con el requisito de edad pero no tiene licencia lo arrestan (ya sé haha, un poco intenso) y finalmente si no cumple con el requisito de la edad el policía llama a sus padres pues es un niño pequeño haha.

Saludos!

Ingrese aquí la descripción de esta imagen para ayudar con la accesibilidadIngrese aquí la descripción de esta imagen para ayudar con la accesibilidadIngrese aquí la descripción de esta imagen para ayudar con la accesibilidad

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Unit 5, Driver License</title>
</head>
<body>

    <h1>Driver's License</h1>
    <script>
        function saltarLinea() {
            document.write("<br><br><br><hr><br><br>");      
        }  
        function imprimir(frase) {
            document.write("<big>" + frase + "</big>");
            saltarLinea();
        }   
        alert("I am going to ask you some questions.");
        var age = parseInt(prompt("How old are you?"));    

        if (age >= 18){
            var driversLicense = prompt("Have you a Driver's License? Answer pls, Y or N");
            if (driversLicense == "Y" | driversLicense == "y"){
            imprimir("Good, you are authorized to drive!");
            document.write('<img src="/BEGINNER_PROGRAMMER/PROGRAMMING_LOGIC_TWO/U1_DIFFERENT_CODE_DEPENDING/img/02_happyman.jpg" alt="A happy man" width="650" height"650">');
            }
            else{
                imprimir("You cannot drive and put your hands where I can see them!");
                document.write('<img src="/BEGINNER_PROGRAMMER/PROGRAMMING_LOGIC_TWO/U1_DIFFERENT_CODE_DEPENDING/img/01_manArrested.jpg" alt="Man arrested width="650" height"650"">')
            }
        }
        else if (age <= 18){
            imprimir("You are a kid, I'll phone your parents");
            document.write('<img src="/BEGINNER_PROGRAMMER/PROGRAMMING_LOGIC_TWO/U1_DIFFERENT_CODE_DEPENDING/img/03_policenAndKid.jpg" alt="A kid arrested" width="650" height"650">')
        }

    </script>   
</body>
</html>
1 respuesta

-Me gusto mucho! Bastante creativo! ]Felicitaciones!