borkins

02b. Excellent or Not

Mar 23rd, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. /*
  2.  * Simple Conditions
  3.  */
  4. import java.util.Scanner;
  5.  
  6. public class _02b_ExcellentOrNot
  7. {
  8.     public static void main(String[] args)
  9.     {
  10.         Scanner scan = new Scanner(System.in);
  11.  
  12.         double grade = Double.parseDouble(scan.nextLine());
  13.  
  14.         // Using ternary operator (?:) to print the correct result
  15.         // result = condition ? Statement1 : Statement2;
  16.         System.out.println((grade >= 5.50) ? "Excellent!" : "Not excellent.");
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment