Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package plodove;
- import java.util.Scanner;
- public class plod {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String producti = scan.nextLine();
- boolean Plodove = producti.equals("banana") || producti.equals("apple") || producti.equals("kiwi")
- || producti.equals("lemon") || producti.equals("cherry") || producti.equals("grapes");
- boolean Zelenchuci = producti.endsWith("tomato") || producti.equals("cucumber") || producti.equals("pepper")
- || producti.equals("carrot");
- if(Plodove) {
- System.out.println("fruit");
- }else if (Zelenchuci) {
- System.out.println("vegetable");
- }else {
- System.out.println("unknown");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement