why is my code not showing in the console? It doesn;t even show error. It shows nothing in the console and I am not seeing any syntax or compilation error.
public class Practice11 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int weight = 116;
if( weight < 116) {
System.out.println(" Eat 5 banana splits! ");
}
else if( weight > 116 && weight < 130 ){
System.out.println(" Eat a banana split! ");
}
else if (weight > 131 && weight < 200) {
System.out.println(" Perfect! ");
}
else if ( weight > 200) {
System.out.println(" Plenty of banana splits have been consumed! ");
}
}
}
I was trying to write a code with multiple if else statements. I was expecting results in the console with the conditon provided below, this is the practice
Write a series of if statement statements that evaluates a person’s weight on the following criteria:
• A weight less than 116 pounds, output: Eat 5 banana splits!
• A weight between 116 pounds and 130 pounds, output: Eat a banana split!
• A weight between 131 pounds and 200 pounds, output: Perfect!
• A weight greater than 200 pounds, output: Plenty of banana splits have been consumed!
Honorine I is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1