mmayoub

bagrut 2016, ex 02

Sep 26th, 2017
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Game.java
  2. ----------
  3. package myGames;
  4.  
  5. public class Game {
  6.     private String gameName;
  7.     private int numPlayers;
  8.     private boolean isWater;
  9.  
  10.     public Game(String gameName, int numPlayers, boolean isWater) {
  11.         this.gameName = gameName;
  12.         this.numPlayers = numPlayers;
  13.         this.isWater = isWater;
  14.     }
  15.  
  16.     public String getGameName() {
  17.         return gameName;
  18.     }
  19.  
  20.     public void setGameName(String gameName) {
  21.         this.gameName = gameName;
  22.     }
  23.  
  24.     public int getNumPlayers() {
  25.         return numPlayers;
  26.     }
  27.  
  28.     public void setNumPlayers(int numPlayers) {
  29.         this.numPlayers = numPlayers;
  30.     }
  31.  
  32.     public boolean isWater() {
  33.         return isWater;
  34.     }
  35.  
  36.     public void setWater(boolean isWater) {
  37.         this.isWater = isWater;
  38.     }
  39.  
  40. }
  41.  
  42. Country.java
  43. -------------
  44. package myGames;
  45.  
  46. public class Country {
  47.     private String countryName;
  48.     private Game[] games;
  49.  
  50.     public Country(String countryName) {
  51.         this.countryName = countryName;
  52.         this.games = new Game[43];
  53.     }
  54.  
  55.     public boolean isPlay(String gameName) {
  56.         for (int i = 0; i < games.length; i += 1) {
  57.             if (games[i].getGameName().equals(gameName))
  58.                 return true;
  59.         }
  60.  
  61.         return false;
  62.     }
  63.  
  64. }
RAW Paste Data