Advertisement
tchenkov

L04u04_FruitOrVegetable

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