desislava_topuzakova

09

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