Advertisement
galinyotsev123

ProgBasicsJavaBook4.1ComplexConditions04FruitOrVegetable2

Jan 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E04FruitOrVegetable{
  4. public static void main(String[] Arg) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String product = scanner.nextLine();
  8.  
  9. if (product.equals("banana") || product.equals("apple")
  10. || product.equals("kiwi") || product.equals("cherry")
  11. || product.equals("lemon") || product.equals("grapes")) {
  12. System.out.println("fruit");
  13. } else if (product.equals("tomato") || product.equals("cucumber")
  14. || product.equals("pepper") || product.equals("carrot")) {
  15. System.out.println("vegetable");
  16. } else {
  17. System.out.println("unknown");
  18.  
  19. }
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement