From 0e7403293aa33cc88fe0849f5c7b256a09948c9e Mon Sep 17 00:00:00 2001 From: Joe Hill Date: Fri, 24 Mar 2017 20:48:39 -0400 Subject: [PATCH] Alot of things are unfinished so don't hate me --- bin/controller/Cashflow.class | Bin 1765 -> 1708 bytes src/controller/Cashflow.java | 9 +++--- src/model/DealTile.java | 41 ++++++++++++++++++++++++++ src/model/FinancialStatement.java | 31 +++++++++++++++++-- src/model/GameBoard.java | 27 +++++++++++++++++ src/model/MarketStack.java | 5 +--- src/model/OwnedRealEstate.java | 33 +++++++++++++++++++++ src/model/Player.java | 21 +++++++++---- src/model/Stock.java | 38 ++++++++++++++++++++++++ src/model/Tile.java | 18 ++++++++++- src/model/TileCircularLinkedList.java | 2 +- 11 files changed, 206 insertions(+), 19 deletions(-) create mode 100644 src/model/OwnedRealEstate.java create mode 100644 src/model/Stock.java diff --git a/bin/controller/Cashflow.class b/bin/controller/Cashflow.class index d6dc11f8cec25c7b45e7e9d1c8bf37540b861076..79d608d743c49e8efd5aa0d1b21960e0d35aa471 100644 GIT binary patch literal 1708 zcmbVMO>-MX5Pf4QUU{>M6IqG_#9;#%B%4H#1QX)KCU)YFpu`3_4vGP1ERE$2`=MH` zOqnx(fCE%#RjFQO9Otb{*ebD_3scBZGh=k@D1^XJoFe*J)E)d0$vm_>MANbUlIh-&iCOg&KVdwz({$k87a@g%dqJcv`9{_ zbEXp%7kOaBW0myA4ZI>S_&l1amgCk`XyP@zZeaLe>KLzuH;^ZkP3gAO!aCFE=L?6c zGI1Uwn!{1;ad^M5oWccxo@=)DELwOAZ?hY+(NI47c;Tp!Ls`0L$2CWnEh^_7)=Z8L zf$HdlHNPuhc8H#)I82P;Jqy>MRl>L>C(<3x=KrIh8x|&F-zexb&&2zfGH{b>jhQ^i zv4v?}zR}RMyM79{1=4p~&B$&9th1(T&tlfX9Oem}Mu8JNdk>(NjtuKm*1!?UA$=aV zvfY6F(qZ6nEo_HUiUlKhf^c|>-|~ne*4JIx=*qXJ9`Gc6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P$d79N@9%YE zoZFgg@q8z)9_R$0%D58(D|>-c4AX(>u@)YD_w=8A%qFV?3Pdn_AV<2BL)VkkkwPn; lf31m$wh87g)>bp0?qK~7S`#saZDGtGNM-Jo^C _realEstate = new ArrayList(); public FinancialStatement(Profession p) { + // TODO Set each major line item to the sum of the smaller ones salary = p.getSalary(); } - public void setChildExp(int i) // One fo these for each of the little line items that actually change + public void setChildExp(int i) // One of these for each of the little line items that actually change { //childExp = i; update(); @@ -33,7 +40,19 @@ private void update() } - + public void buyStock(int numShares, int sharePrice) + { + _stock = new Stock(numShares, sharePrice); + int cashOut = _stock.getCashOut(); + _cashBalance += cashOut; // getCashOut() will negate the value automatically so we will add not subtract + } + + public void sellStock() + { + _cashBalance += _stock.getSharePrice() * _stock.getNumShares(); + _stock = null; + } + Profession p = new Profession("Teacher", 3300, 500, 500, 100, 100, 200, 700, 0, 0, 200, 400, 50000, 12000, 5000, 4000); @@ -67,4 +86,12 @@ public void display() { } + + public int getCashBalance() { + return _cashBalance; + } + + public void increaseCashBalance(int cashIncrease) { + this._cashBalance =+ cashIncrease; + } } diff --git a/src/model/GameBoard.java b/src/model/GameBoard.java index 874ca93..23026f9 100644 --- a/src/model/GameBoard.java +++ b/src/model/GameBoard.java @@ -2,6 +2,7 @@ import java.util.LinkedList; import java.util.Queue; +import model.TileCircularLinkedList.Node; public class GameBoard { @@ -20,4 +21,30 @@ public GameBoard() _tiles.addTiles(t1, t2, t3, t4); } + + // TODO This method will move the player and return true if they passed a payday along the way. + // It also removes the player from the _players ArrayList of their initial tile and adds them to the + // arraylist of the tile they land on + public boolean movePlayer(Player p, int distance) + { + int currentLocation = p.getLocation(); + Node currentNode = _tiles.get(currentLocation); + Tile currentTile = _tiles.elementAt(currentLocation); + currentTile.removePlayer(p); + boolean passedPayday = false; + for(int i=0; i>>>>>> branch 'master' of https://github.uconn.edu/joh13010/2102-Group-Project-Spring-2017.git public void Action(Player player){ currentcard = _marketCardStack.pop(); currentcard.display(); //will be a method in MarketCard to display the GUI for the card diff --git a/src/model/OwnedRealEstate.java b/src/model/OwnedRealEstate.java new file mode 100644 index 0000000..7c2c321 --- /dev/null +++ b/src/model/OwnedRealEstate.java @@ -0,0 +1,33 @@ +package model; + +public class OwnedRealEstate +{ + private String _name; + private int _price; + private int _downPayment; + + public OwnedRealEstate(String name, int price, int downPayment) + { + _name = name; + _price = price; + _downPayment = downPayment; + } + + public String getName() { + return _name; + } + + public int getPrice() { + return _price; + } + + public int getDownPayment() { + return _downPayment; + } + + + + + + +} diff --git a/src/model/Player.java b/src/model/Player.java index c8972bd..33ae03f 100644 --- a/src/model/Player.java +++ b/src/model/Player.java @@ -2,7 +2,7 @@ public class Player { - public FinancialStatement _fs; //financial statement of user + private FinancialStatement _fs; //financial statement of user //idNumber? // public boolean _charity; private int _CharityCount; //charity counter @@ -10,6 +10,12 @@ public class Player private int _location; private boolean _winner = false; + public Player() { //constructor + // TODO: Pick profession + _location = 0; + } + + public boolean hasWon() { return _winner; } @@ -19,22 +25,25 @@ public void pickCard() { } + public FinancialStatement getFinancialStatement() + { + return _fs; + } + public boolean donateCharity() { // return false; } - public void setLocation() { - + public void setLocation(int i) { + _location = i; } public int getLocation() { return this._location; } - public Player() { //constructer - - } + } diff --git a/src/model/Stock.java b/src/model/Stock.java new file mode 100644 index 0000000..d224b57 --- /dev/null +++ b/src/model/Stock.java @@ -0,0 +1,38 @@ +package model; + +public class Stock +{ + private static int _sharePrice; + private int _numShares; + + public Stock(int sharePrice, int numShares) + { + _sharePrice = sharePrice; + _numShares = numShares; + } + + public void setSharePrice(int newPrice) + { + _sharePrice = newPrice; + } + + public int getSharePrice() + { + return _sharePrice; + } + + /** + * + * @return returns NEGATED version of the cash outlay for a stock + */ + public int getCashOut() + { + return -1 * _sharePrice * _numShares; + } + + public int getNumShares() + { + return _numShares; + } + +} \ No newline at end of file diff --git a/src/model/Tile.java b/src/model/Tile.java index acce69a..3e37e71 100644 --- a/src/model/Tile.java +++ b/src/model/Tile.java @@ -1,10 +1,12 @@ package model; +import java.util.ArrayList; + public class Tile { private String _name; private int _boardIndex; - private Player[] _players; + private ArrayList _players; public Tile(String name, int boardIndex) { @@ -22,5 +24,19 @@ public String getName() return _name; } + public void getLandedOn() + { + + } + + public void addPlayer(Player p) + { + _players.add(p); + } + + public void removePlayer(Player p) + { + _players.remove(p); + } } diff --git a/src/model/TileCircularLinkedList.java b/src/model/TileCircularLinkedList.java index 6935b42..5a15fd7 100644 --- a/src/model/TileCircularLinkedList.java +++ b/src/model/TileCircularLinkedList.java @@ -2,7 +2,7 @@ public class TileCircularLinkedList { - class Node { + public class Node { Tile t; Node next; public Node(Tile tile) {