Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

It displays something it shouldn't

$
0
0
Hello, I'm writing a simple code that will determine your mark based on your score.
Here's the code
 import java.util.Scanner;
public class ap {
         public static void main (String args[]){
           Scanner J = new Scanner(System.in);
           double a;
       System.out.print("enter your score: ");
       a = J.nextDouble();
       if(a>100)
       {
    	System.out.println("please enter a number between 0 and 100");   
       }
       
       if(a==100)
       {
    	   
    	   
    	   System.out.println("A+");
       }
     if(a==0);
    	   System.out.println("F-");
       
       if(a>=90 && a<=99)
       {
    	   
    	   System.out.println("A");
    	   
       }
   if(a>=80 && a<=89){
	   System.out.println("B+");
	   

}
   if(a>=70 && a<=79){
	   
	   System.out.println("B");
	   
   }
   if(a>=60 && a<=69)
   {
	System.out.println("C");
	
   }
  if(a>0 && a<=59)
  {
	  System.out.println("F");
	  
  }
   }
}



Now here's the problem, when I try to enter number: 100, it displays
A+ AND F-
It's same with any other number, along with proper mark it also displays F- for some reason.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>