borkins

04. Fruit or Vegetable

Mar 26th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. /**
  2.  * Project: Complex_Conditions - created by borkins on 2017-03-26.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _04_FruitOrVegetable
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.        
  13.         String product = console.nextLine();
  14.        
  15.         switch (product)
  16.         {
  17.             case "banana":
  18.             case "apple":
  19.             case "kiwi":
  20.             case "cherry":
  21.             case "lemon":
  22.             case "grapes":
  23.                 System.out.println("fruit");
  24.                 break;
  25.             case "tomato":
  26.             case "cucumber":
  27.             case "pepper":
  28.             case "carrot":
  29.                 System.out.println("vegetable");
  30.                 break;
  31.             default:
  32.                 System.out.println("unknown");
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment