Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Complex_Conditions - created by borkins on 2017-03-26.
- */
- import java.util.Scanner;
- public class _04_FruitOrVegetable
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- String product = console.nextLine();
- switch (product)
- {
- case "banana":
- case "apple":
- case "kiwi":
- case "cherry":
- case "lemon":
- case "grapes":
- System.out.println("fruit");
- break;
- case "tomato":
- case "cucumber":
- case "pepper":
- case "carrot":
- System.out.println("vegetable");
- break;
- default:
- System.out.println("unknown");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment