Actor :



package monopoly.actors;



public abstract class Actor
 {
   protected String name;
   protected int kontoStand;
   public Actor( String name, int kontoStand )
     {
       this.name = name;
       this.kontoStand = kontoStand;
     }

 }




Bank :

package monopoly.actors;

public class Bank extends Actor
 {
   int house = 32;
   int hotel = 16;

     public Bank()
      {
        super(" banken ",10000000);



      }
     public String getName()
      {
        return this.name;
      }
 }
spieler :

package monopoly.actors;
import monopoly.fields.*;
import monopoly.game.*;
import java.util.*;
public class Player extends Actor implements PlayerInterface

 {
     private Bank bank;
     private ArrayList fieldList;
     private Field fieldStart;
     private Field currentField;
     public Player( String name, int kontoStand, Field fieldStart, Field currentField )
      {
         super(name,kontoStand);
         this.bank = bank;
         fieldList = new ArrayList();
         this.fieldStart = fieldStart;
         this.currentField = currentField;
      }
     public String getName()
      {
         return this.name;
      }
     public void youTurn(Dice dice)
      {
         dice.throwDice();
         int n = dice.sum();
         System.out.println( " Spieler"+ name +"_ hat gewurfelt" + n );
      }

     public int getBalance()
       {
         return this.kontoStand;
       }
      public FieldInterface getCurrentField()
       {
         return this.currentField;
       }
      public Iterator getPropertyIterator()
        {
           return fieldList.iterator();
        }

 }
Field :

package monopoly.fields;
import monopoly.actors.*;



public class Field implements FieldInterface
 {
   protected String name;
   protected int index;
   protected Bank bank;
   public int getIndex()
     {
       return this.index;
     }
   public String getName()
     {
       return this.name;
     }
 }




monopolygame :




package monopoly.game;
import monopoly.fields.*;
import monopoly.actors.*;
import simpleInput.*;
import monopoly.support.*;




class MonopolyGame
  {
    Field fieldStart;
    Field currentField;
    Player [] playerArray;
    Dice dice;
    MonopolyGUI gui;
    public static void main (String [] args )
     {
        MonopolyGame monoGame = new MonopolyGame();
     System.out.println("Spiel erzeugt");
        monoGame.start();
      }
public MonopolyGame()
      {
          gui = new MonopolyGUI();
      System.out.println("konstruktor");
        SimpleInput input = new SimpleInput();
    System.out.println("Bitte Spielerzahl eingeben");

           int zahl = input.nextInt();

           if ( zahl > 6 )
             {
                System.out.println( " Muss kleiner oder gleich als 6 " );
             }
           else
             {
                playerArray = new Player[zahl];
                for(int i = 0; i < zahl; i++)
                  {
                     Player player = new Player ( " spieler " + i+1, 1500, fieldStart, currentField );
                     playerArray [i] = player;
                    gui.registerPlayer(player);

                }
            }
           Bank bank = new Bank ();
      }
    public void start()
      {
        int i = 0;

           dice = new Dice();
           while( true )
            {
              playerArray[i].youTurn(dice);
              i++;
              if(i == playerArray.length)
                {
                   i = 0;
                }
            }
       }
}

More Related Content

PDF
The Ring programming language version 1.3 book - Part 40 of 88
PDF
The Ring programming language version 1.3 book - Part 52 of 88
PDF
The Ring programming language version 1.5.3 book - Part 50 of 184
DOC
BingoConsoleApp
PPTX
Making Games in JavaScript
PPTX
Oprerator overloading
PDF
The Ring programming language version 1.2 book - Part 38 of 84
The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 52 of 88
The Ring programming language version 1.5.3 book - Part 50 of 184
BingoConsoleApp
Making Games in JavaScript
Oprerator overloading
The Ring programming language version 1.2 book - Part 38 of 84

What's hot (20)

PDF
The Ring programming language version 1.5 book - Part 9 of 31
PDF
The Ring programming language version 1.5.3 book - Part 79 of 184
PDF
The Ring programming language version 1.5.1 book - Part 49 of 180
PDF
The Ring programming language version 1.4.1 book - Part 15 of 31
PDF
The Ring programming language version 1.9 book - Part 60 of 210
PDF
The Ring programming language version 1.5.4 book - Part 53 of 185
PDF
The Ring programming language version 1.8 book - Part 57 of 202
PDF
Lập trình Python cơ bản
PDF
The Ring programming language version 1.5.3 book - Part 61 of 184
PDF
The Ring programming language version 1.5.4 book - Part 51 of 185
PDF
MongoDBで作るソーシャルデータ新解析基盤
PDF
The Ring programming language version 1.7 book - Part 55 of 196
PDF
The Ring programming language version 1.9 book - Part 61 of 210
PDF
The Ring programming language version 1.3 book - Part 41 of 88
PDF
MongoDB全機能解説2
RTF
project3
PDF
The Ring programming language version 1.2 book - Part 39 of 84
PDF
A promise is a Promise
PDF
The Ring programming language version 1.3 book - Part 42 of 88
The Ring programming language version 1.5 book - Part 9 of 31
The Ring programming language version 1.5.3 book - Part 79 of 184
The Ring programming language version 1.5.1 book - Part 49 of 180
The Ring programming language version 1.4.1 book - Part 15 of 31
The Ring programming language version 1.9 book - Part 60 of 210
The Ring programming language version 1.5.4 book - Part 53 of 185
The Ring programming language version 1.8 book - Part 57 of 202
Lập trình Python cơ bản
The Ring programming language version 1.5.3 book - Part 61 of 184
The Ring programming language version 1.5.4 book - Part 51 of 185
MongoDBで作るソーシャルデータ新解析基盤
The Ring programming language version 1.7 book - Part 55 of 196
The Ring programming language version 1.9 book - Part 61 of 210
The Ring programming language version 1.3 book - Part 41 of 88
MongoDB全機能解説2
project3
The Ring programming language version 1.2 book - Part 39 of 84
A promise is a Promise
The Ring programming language version 1.3 book - Part 42 of 88
Ad

Similar to 3 1-1 (7)

PDF
question.(player, entity ,field and base.java codes are given)Stop.pdf
PDF
package com.tictactoe; public class Main {public void play() {.pdf
PDF
The main class of the tictoe game looks like.public class Main {.pdf
PDF
Here is the game description- Here is the sample game- Here is the req.pdf
PDF
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
PDF
Please use java to write the program that simulates the card game!!! T (1).pdf
PDF
Goal- Your goal in this assignment is to write a Java program that sim.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdf
package com.tictactoe; public class Main {public void play() {.pdf
The main class of the tictoe game looks like.public class Main {.pdf
Here is the game description- Here is the sample game- Here is the req.pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
Please use java to write the program that simulates the card game!!! T (1).pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdf
Ad

Recently uploaded (20)

PDF
The Influence of Historical Figures on Legal Communication (www.kiu.ac.ug)
PDF
Investment in CUBA. Basic information for United States businessmen (1957)
PDF
Handouts for Housekeeping.pdfbababvsvvNnnh
PPTX
Chapter 2 strategic Presentation (6).pptx
PPT
BCG内部幻灯片撰写. slide template BCG.slide template
PPTX
Oracle Cloud Infrastructure Overview July 2020 v2_EN20200717.pptx
PPTX
Market and Demand Analysis.pptx for Management students
PPTX
Warehouse. B pptx
PDF
757557697-CERTIKIT-ISO22301-Implementation-Guide-v6.pdf
DOCX
Handbook of entrepreneurship- Chapter 10 - Feasibility analysis by Subin K Mohan
DOCX
“Strategic management process of a selected organization”.Nestle-docx.docx
PPTX
Side hustles: 14 powerful tips to embrace the future of work
PPTX
Accounting Management SystemBatch-4.pptx
PDF
109422672-Doc-8973-05-Security-Manual-Seventh-Edition.pdf
PDF
The Impact of Historical Events on Legal Communication Styles (www.kiu.ac.ug)
PPTX
Enterprises are Classified into Two Categories
PDF
the role of manager in strategic alliances
PDF
Nante Industrial Plug Socket Connector Sustainability Insights
PPTX
Supply Chain under WAR (Managing Supply Chain Amid Political Conflict).pptx
PDF
audit case scenario .pdf by icai ca inter
The Influence of Historical Figures on Legal Communication (www.kiu.ac.ug)
Investment in CUBA. Basic information for United States businessmen (1957)
Handouts for Housekeeping.pdfbababvsvvNnnh
Chapter 2 strategic Presentation (6).pptx
BCG内部幻灯片撰写. slide template BCG.slide template
Oracle Cloud Infrastructure Overview July 2020 v2_EN20200717.pptx
Market and Demand Analysis.pptx for Management students
Warehouse. B pptx
757557697-CERTIKIT-ISO22301-Implementation-Guide-v6.pdf
Handbook of entrepreneurship- Chapter 10 - Feasibility analysis by Subin K Mohan
“Strategic management process of a selected organization”.Nestle-docx.docx
Side hustles: 14 powerful tips to embrace the future of work
Accounting Management SystemBatch-4.pptx
109422672-Doc-8973-05-Security-Manual-Seventh-Edition.pdf
The Impact of Historical Events on Legal Communication Styles (www.kiu.ac.ug)
Enterprises are Classified into Two Categories
the role of manager in strategic alliances
Nante Industrial Plug Socket Connector Sustainability Insights
Supply Chain under WAR (Managing Supply Chain Amid Political Conflict).pptx
audit case scenario .pdf by icai ca inter

3 1-1

  • 1. Actor : package monopoly.actors; public abstract class Actor { protected String name; protected int kontoStand; public Actor( String name, int kontoStand ) { this.name = name; this.kontoStand = kontoStand; } } Bank : package monopoly.actors; public class Bank extends Actor { int house = 32; int hotel = 16; public Bank() { super(" banken ",10000000); } public String getName() { return this.name; } }
  • 2. spieler : package monopoly.actors; import monopoly.fields.*; import monopoly.game.*; import java.util.*; public class Player extends Actor implements PlayerInterface { private Bank bank; private ArrayList fieldList; private Field fieldStart; private Field currentField; public Player( String name, int kontoStand, Field fieldStart, Field currentField ) { super(name,kontoStand); this.bank = bank; fieldList = new ArrayList(); this.fieldStart = fieldStart; this.currentField = currentField; } public String getName() { return this.name; } public void youTurn(Dice dice) { dice.throwDice(); int n = dice.sum(); System.out.println( " Spieler"+ name +"_ hat gewurfelt" + n ); } public int getBalance() { return this.kontoStand; } public FieldInterface getCurrentField() { return this.currentField; } public Iterator getPropertyIterator() { return fieldList.iterator(); } }
  • 3. Field : package monopoly.fields; import monopoly.actors.*; public class Field implements FieldInterface { protected String name; protected int index; protected Bank bank; public int getIndex() { return this.index; } public String getName() { return this.name; } } monopolygame : package monopoly.game; import monopoly.fields.*; import monopoly.actors.*; import simpleInput.*; import monopoly.support.*; class MonopolyGame { Field fieldStart; Field currentField; Player [] playerArray; Dice dice; MonopolyGUI gui; public static void main (String [] args ) { MonopolyGame monoGame = new MonopolyGame(); System.out.println("Spiel erzeugt"); monoGame.start(); }
  • 4. public MonopolyGame() { gui = new MonopolyGUI(); System.out.println("konstruktor"); SimpleInput input = new SimpleInput(); System.out.println("Bitte Spielerzahl eingeben"); int zahl = input.nextInt(); if ( zahl > 6 ) { System.out.println( " Muss kleiner oder gleich als 6 " ); } else { playerArray = new Player[zahl]; for(int i = 0; i < zahl; i++) { Player player = new Player ( " spieler " + i+1, 1500, fieldStart, currentField ); playerArray [i] = player; gui.registerPlayer(player); } } Bank bank = new Bank (); } public void start() { int i = 0; dice = new Dice(); while( true ) { playerArray[i].youTurn(dice); i++; if(i == playerArray.length) { i = 0; } } } }