Advertisement
apez1

Term 1: Lesson 13 - Coding Activity 4

Sep 25th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1.  
  2.  
  3.     import java.io.*;
  4. import static java.lang.System.*;
  5. import java.util.Scanner;
  6. import java.lang.Math;
  7.  
  8. public class Lesson_13_Activity_Four {
  9.     public static void main (String str[]) throws IOException {
  10.      
  11.      int x;
  12.      
  13.      Scanner scanner = new Scanner(System.in);
  14.      System.out.println("An integer from 0-4");    
  15.      x = scanner.nextInt();
  16.  
  17.      if(x == 0 ) {
  18.       System.out.println("F");
  19.      }
  20.      else if(x == 1 ) {
  21.       System.out.println("D");
  22.      }
  23.      else if(x == 2 ) {
  24.       System.out.println("C");
  25.      }
  26.      else if(x == 3 ) {
  27.       System.out.println("B");
  28.      }
  29.      else if(x == 4 ) {
  30.       System.out.println("A");
  31.      }
  32.      
  33.     }
  34.  
  35.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement