Hello Friends! After a long time I am back to write again about Programming or hacking Stuff. Today I am going to provide you a program based on switch statement. Prior to it, I wrote an article on switch statement so it will be better to view the previous one first. Here is the link of that article JAVA PROGRAMMING TUTORIAL 10: SWITCH STATEMENT . Now follow the below program to understand what I am trying to teach you-
public class HackDefence {
public static void main(String args[]){
int overallPercentage = 50;
switch(overallPercentage){
case 90 :
System.out.println("Excellent!");
break;
case 80 :
System.out.println("Well done");
break;
case 50 :
System.out.println("You may suffer but still You will get lot of scope");
break;
case 29 :
System.out.println("Better try again");
break;
default :
System.out.println("Invalid grade");
}
System.out.println("Your overall percentage is " + overallPercentage);
}
}
(my facebook link: https://www.facebook.com/dipankar.choudhury1 )
OUTPUT:
No comments:
Post a Comment