Advertisement
Yuvalxp8

Bagrut 2017

Apr 5th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. import java.util.*;
  2. public class BAGRUT
  3. {
  4.     public static int big(int[] arr) //מקבל מערך של מספרים שלמים ומחזיר את האינדקס המינימלי של המספר המקסימלי
  5.     {
  6.         int index = 0;
  7.         int biggest = arr[0];
  8.         for(int i = 0 ; i < arr.length ; i ++)
  9.         {
  10.             if(arr[i] > biggest)
  11.             {
  12.                 biggest = arr[i];
  13.                 index = i;
  14.             }
  15.         }
  16.         return index;
  17.     }
  18.    
  19.     public class Game
  20.     {
  21.         private String gameName;
  22.         private int numPlayers;
  23.         private boolean isWater;
  24.        
  25.             public String getGameName()
  26.             {
  27.                 return gameName;
  28.             }
  29.            
  30.             public void setGameName(String gameName)
  31.             {
  32.                 this.gameName = gameName;
  33.             }
  34.            
  35.             public int getNumPlayers()
  36.             {
  37.                 return numPlayers;
  38.             }
  39.            
  40.             public void setNumPlayers(int numPlayers)
  41.             {
  42.                 this.numPlayers = numPlayers;
  43.             }
  44.            
  45.             public boolean isWater()
  46.             {
  47.                 return isWater;
  48.             }
  49.            
  50.             public void setWater(boolean isWater)
  51.             {
  52.                 this.isWater = isWater;
  53.             }
  54.    
  55.         public Game(String gameName , int numPlayers , boolean isWater)
  56.         {
  57.             this.gameName = gameName;
  58.             this.numPlayers = numPlayers;
  59.             this.isWater = isWater;
  60.         }
  61.     }
  62.    
  63.     public class Country
  64.     {
  65.         private String countryName;
  66.         public static int size = 43;
  67.         private Game[] games;
  68.         private int actualGames;
  69.        
  70.         public Country(String name)
  71.         {
  72.             this.countryName = name;
  73.             this.games = new Game[size];
  74.             this.actualGames = 0;
  75.         }
  76.        
  77.         public boolean isParticipating (String name)
  78.         {
  79.             for(int i = 0 ; i < 42 ; i++)
  80.                 if(this.games[i].getGameName().equals(name))
  81.                     return true;
  82.            
  83.             return false;
  84.         }
  85.  
  86.     }
  87.    
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement