Monday, March 7, 2022

Java - what about this piece about hours

 public void reaction(int hour, int minutes){

    if(hour<12 || hour == 12 && minutes==0){
System.out.println("The dog waves the tale at "+hour+":"+minutes);
}else if(hora< 18 || hour == 18 && minutes==0){
System.out.println("The dog ignores at "+hour+":"+minutes);
}else if (hora>18 || hour ==18 && minutes !=0){
System.out.println("The dog waves the tale and bark "+hour+":"+minutes);
}else{
System.out.println("Something went wrong!, revise the CODE!!!");
}

}

This is a solution when you don't want full hours, but one second after a full hour, and the else is a test to try to find any miss in the code. Rute Bezerra de Menezes Gondim 


No comments:

Post a Comment