2010-11-29 15 views
-1
import java.util.Scanner; 

public class nothing 

{ 

    public static void main (String arge[]) 


    { 

     Scanner input = new Scanner (System.in); 

     int mork; 
     int mork1; 
     int mork2; 
     int mork3; 


     System.out.print (" Enter The mork "); 
     mork = input.nextInt(); 

     if (mork > 90) 
     System.out.print("A"); 

     if (mork1 > 80) 
     System.out.print("B"); 

     if (mork2 > 70) 
      System.out.print("C"); 

     if (mork3 >= 60) 
      System.out.print("D"); 

     else System.out.print("H"); 



    } 
+3

Um, quelle est votre question? –

+0

** C'est _not_ Javascript **! – SLaks

+0

Je ne vois aucun JavaScript ici ... – BoltClock

Répondre

1

C'est certainement JAVA pas JavaScript ...

[EDIT]

Voici moyen valable de faire un if/else if/else statment dans Java, si c'est ce que vous demandez ...

import java.util.Scanner; 

public class nothing { 
    public static void main(String[] args) { 
     Scanner input = new Scanner(System.in); 

     int mork; 
     int mork1; // <--- never used... 
     int mork2; // <--- never used... 
     int mork3; // <--- never used... 

     System.out.print(" Enter the mork "); 
     mork = input.nextInt(); 

     if(mork > 90) { 
      System.out.print("A"); 
     }else if(mork > 80) { // <-- changed mork1 to mork since mork1 is never initialized 
      System.out.print("B"); 
     }else if(mork > 70) { // <-- changed mork2 to mork since mork2 is never initialized 
      System.out.print("C"); 
     }else if(mork >= 60) { // <-- changed mork3 to mork since mork3 is never initialized 
      System.out.print("D"); 
     }else{ 
      System.out.print("H"); 
     } 
    } 
} 
+0

Et je suppose que vous utilisez toutes les majuscules pour souligner et non parce que Java est un acronyme (ce qui n'est pas): P – BoltClock

+0

bonne hypothèse: P – subhaze

+0

C'est certainement un commentaire, pas une réponse. –