Answer:
public class walk {
//create the function
public static void takeAwalk(int spare_Minute) {
//check the condition and print if match
if(spare_Minute>=60) {
System.out.println("Store");
}else if(spare_Minute>=10) {
System.out.println("Block");
}else {
System.out.println("Nowhere");
}
public static void main(String[] args) {
//call the function
takeAwalk(60);
}
}
Step-by-step explanation:
Create the class and define the function takeAwalk which takes one parameter of integer type and the function return type is void. It means the function does not return any value.
In the function, take the continuous if-else statement.
syntax:
if(condition){
statement;
}else if(condition){
statement;
}else{
statement;
}
it takes the condition, if the condition is true then execute the statement otherwise program move to the else if() part. if this is also false then the program moves to the else part.
create the main function for testing the program and call the function.
suppose the value pass is 60.
then, program control moves to the function definition and start executing.
if-else statement checks the condition, 60 >= 60 condition match and the program print the message "Store".