Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package yourmama;
- import java.util.*;
- /**
- *
- * @author Student
- */
- public class Yourmama {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner scan =new Scanner (System.in);
- System.out.print("Choose color - r/R y/Y b/B: ");
- String c=scan.nextLine();
- System.out.println(" ");
- if(c.equals("R")|| c.equals("r"))
- {System.out.println("Red");}
- else if(c.equals("Y")|| c.equals("y"))
- {System.out.println("Yellow");}
- else if(c.equals("B")|| c.equals("b"))
- {System.out.println("Blue");}
- else
- {System.out.println("Out of range");}
- }
- }
- /*
- *Input with .toUppercase shortcut
- */
- package yourmama;
- import java.util.*;
- /**
- *
- * @author Student
- */
- public class Yourmama {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner scan =new Scanner (System.in);
- System.out.print("Choose color - r/R y/Y b/B: ");
- String c=scan.nextLine();
- c=c.toUpperCase();
- System.out.println(" ");
- if(c.equals("R"))
- {System.out.println("Red");}
- else if(c.equals("Y"))
- {System.out.println("Yellow");}
- else if(c.equals("B"))
- {System.out.println("Blue");}
- else
- {System.out.println("Out of range");}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement