SHARE
TWEET

Untitled

a guest Jun 25th, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Calculator {
  2.     class Score{
  3.         int score;
  4.         int playerId;
  5.     }
  6.  
  7.     class RatingCalculator extends Score {
  8.         ArrayList<CalculatorForBoxing> newGame;
  9.         public CalculatorForBoxing boxer1;
  10.         public CalculatorForBoxing boxer2;
  11.  
  12.  
  13.         ArrayList<Integer> getScores(){
  14.             return myArrayList;
  15.         }
  16.     }
  17.      
  18. class CalculatorForBoxing extends RatingCalculator implements RateByAccumulatingPoints {
  19.  
  20.         int forbiddenKicks;
  21.         int successfullKicks;
  22.  
  23.         public  CalculatorForBoxing  (int playerId, int score, int forbiddenKicks, int successfullKicks ) {
  24.             this.playerId = playerId;
  25.             this.score = score;
  26.             this.forbiddenKicks = forbiddenKicks;
  27.             this.successfullKicks = successfullKicks;
  28.             }
  29.         public void setPlayerId(int playerId) {
  30.             this.playerId = playerId;
  31.         }
  32.  
  33.         public int getPlayerId() {
  34.             return playerId;
  35.         }
  36.         public void setScore(int score) {
  37.             this.score = score;
  38.         }
  39.         public int getScore() {
  40.             return score;
  41.         }
  42.  
  43.         @Override
  44.         public void addPoints(int playerId, int points) {
  45.             //some code
  46.             }
  47.         }
  48.     interface RateByAccumulatingPoints {
  49.          void addPoints(int playerId, int points );
  50.         }
  51.      
  52. class Judge extends RatingCalculator  {
  53.  
  54.         // here my simple scenario;
  55.         void rate(RatingCalculator rc){
  56.             newGame = new ArrayList<CalculatorForBoxing>();
  57.             newGame.add(boxer1 = new CalculatorForBoxing(01, 0, 0, 4));
  58.             newGame.add(boxer2 = new CalculatorForBoxing(02, 0, 0, 5));
  59.             newGame.addPoints(01, 20); //haven't access here
  60.             newGame.getScores();       //haven't access here
  61.         }
  62.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top