ThunDerStorm26

Fruit or Vegetable

Jan 27th, 2021
631
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class FruitOrVegetable {
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         String product = scanner.nextLine();
  11.  
  12.         if (product.equals("banana") || product.equals("apple") || product.equals("kiwi")
  13.         || product.equals("cherry") || product.equals("lemon") || product.equals("grapes")){
  14.             System.out.println("fruit");
  15.         }
  16.         else if (product.equals("tomato") || product.equals("cucumber")
  17.         || product.equals("pepper") || product.equals("carrot")){
  18.             System.out.println("vegetable");
  19.         }
  20.         else {
  21.             System.out.println("unknown");
  22.         }
  23.  
  24.  
  25.     }
  26. }
  27.  
RAW Paste Data