Advertisement
MilaDimitrovaa

Plod i Zelenchuk

Dec 1st, 2019
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. package plodove;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class plod {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scan = new Scanner(System.in);
  9.        
  10.         String producti = scan.nextLine();
  11.        
  12.         boolean Plodove = producti.equals("banana") || producti.equals("apple") ||  producti.equals("kiwi")
  13. || producti.equals("lemon") || producti.equals("cherry") || producti.equals("grapes");
  14.        
  15.         boolean Zelenchuci = producti.endsWith("tomato") || producti.equals("cucumber") || producti.equals("pepper")   
  16. || producti.equals("carrot");
  17.        
  18.     if(Plodove) {
  19.         System.out.println("fruit");
  20.     }else if (Zelenchuci) {
  21.         System.out.println("vegetable");
  22.     }else {
  23.         System.out.println("unknown");
  24.                    
  25.                 }
  26.        
  27.  
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement