Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Prints the name of the color for the first letter of the color.
- *
- * @author Stern McGee
- * @version 10/25/14
- */
- import java.util.*;
- public class Problem13
- {
- public static void main(String[] args)
- {
- Scanner console=new Scanner(System.in);
- System.out.print("What color do you want? ");
- String color=console.next();
- if(color=="B")
- {
- color="Blue";
- System.out.print("You have chosen "+color);
- }
- if(color=="G")
- {
- color="Green";
- System.out.print("You have chosen "+color);
- }
- if(color=="R")
- {
- color="Red";
- System.out.print("You have chosen "+color);
- }
- if(color!="B"||color!="G"||color!="R")
- {
- System.out.print("Unknown color: "+color);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement