Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

So I have a question. I think I pretty much wrote the program right but, I can't seem to get it to work. I keep getting an error message because of the "else if(75 > marks > 50){" part of the program. How do I get it to work?

OpenStudy (anonymous):

Here is my program. public class my class { public static void main(String []args) { int marks; if(marks>75){ System.out.println("Excellent"); } else if(75 > marks > 50){ System.out.println("Satisfactory"); } else if(50 > marks > 40){ System.out.println("Needs Improvement"); } else if(marks<40){ System.out.println("Failing"); } } }

OpenStudy (rsmith6559):

else if( ( 75 > marks ) && ( marks > 50 ) ) {

OpenStudy (anonymous):

Thank you. I figured it out like 5 minutes after posting the question. I felt pretty stupid after seeing how simple it was.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!