Advertisement
heysoul_sisypus

name input (char)

Feb 1st, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package yourmama;
  8. import java.util.*;
  9. /**
  10.  *
  11.  * @author Student
  12.  */
  13. public class Yourmama {
  14.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args) {
  19.         Scanner scan =new Scanner (System.in);
  20.         System.out.print("Choose color - r/R y/Y b/B p/P g/G: ");
  21.         char c=scan.nextLine().charAt(0);
  22.         System.out.println(" ");
  23.         if(c=='R'|| c=='r')
  24.         {System.out.println("Red");}
  25.         else if(c=='Y'|| c=='y')
  26.         {System.out.println("Yellow");}
  27.         else if(c=='B'|| c=='b')
  28.         {System.out.println("Blue");}
  29.         else if(c=='P'|| c=='p')
  30.         {System.out.println("Purple");}
  31.         else if(c=='G'|| c=='g')
  32.         {System.out.println("Green");}
  33.         else
  34.         {System.out.println("Out of range");}    
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement