Edit: Apologize for confusing some of you, here is little more details.
I am very new to the stackoverflow. So I apologize in advance for a stupid questions.
I came across the below exercise in Udemy and my code is failing. Please help me understand why it is failing?
Description of the exercise:
/* Write a method shouldWakeUp that has 2 parameters. 1st parameter should of type boolean and be named barking it represents if our dog is currently barking 2nd parameter represents the hour of day and is of the type int with the name hourOfDay and has a valid range of 0-23 we have to wake up if the dog is barking before 8 or after 22 hours so that in that case return true;
in all other case return false;
if the hourOfDay parameter is less than 0 or greater 23 return false *?
public class BarkingDog {
public static boolean shouldWakeUp(boolean barking, int hourOfDay) {
if (hourOfDay < 8 || hourOfDay > 22) {
return true;
} else if (hourOfDay < 0 || hourOfDay > 23) {
}
return false;
}
}
Aucun commentaire:
Enregistrer un commentaire