Create an app that will tell a young guy if he is eligible to drive a car. If he is 18 tell the user that is not eligible to drive if is greater than 22 tell the user is eligible to drive, if the user is greater than 30 years old tell him to get a driver if the user is above 40 years tell the user is too old to drive if the user is above 60 tell the user should call his grandson to drive for him……The code that i have tried…..
var val = prompt (“enter Age”); const d = 22 ; switch (true) { case (d == 2): alert(“You are eligible”); break; case ( d >= 18 ): alert(“You are not eligible”); break; case (d >= 39): alert ( “Get a driver”); break; case (d >=59): alert (“is too old to drive a car” ); break; case (d > 60): alert (“Call your grandson to drive for you”); break; default: alert (“Drive”);
Any hint please