Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.Arrays;
  2.  
  3.  
  4. class InvalidPeppaPigCharacterException extends RuntimeException{
  5.  
  6.     public InvalidPeppaPigCharacterException(String message) {
  7.         super(message);
  8.     }
  9. }
  10.  
  11.  
  12. class CartoonChecker {
  13.  
  14.     public static void processCharacter(String ime){
  15.         String[] characters = Peppa.getAllCharacters();
  16.  
  17.         if (Arrays.asList(characters).contains(ime)){
  18.             System.out.println(ime+ " JE lik u crtanom filmu Peppa Pig");
  19.         } else {
  20.             throw new InvalidPeppaPigCharacterException(ime + " NIJE lik u crtanom filmu Peppa Pig")
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement