Moved everything into logic classes

This commit is contained in:
2019-04-07 14:44:41 -06:00
parent 9e97877e6e
commit e2ad32c4ee
22 changed files with 456 additions and 242 deletions

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
@@ -10,8 +12,9 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import logic.Player;
public class BankGUI extends Player{
public class BankGUI extends Player {
/**
* 2019-03-10
* Authors: Siddhant Dewani
@@ -66,7 +69,7 @@ public class BankGUI extends Player{
hbx1.getChildren().add(b1);
hbx1.getChildren().add(b2);
hbx1.getChildren().add(b3);
hbx1.setPadding(new Insets(0,0,20,0));
hbx1.setPadding(new Insets(0, 0, 20, 0));
brdr1.setBottom(hbx1);
/**
@@ -87,7 +90,7 @@ public class BankGUI extends Player{
vbx1.getChildren().add(l2);
vbx1.getChildren().add(l4);
vbx1.getChildren().add(l5);
vbx1.setPadding(new Insets(20,0,0,0));
vbx1.setPadding(new Insets(20, 0, 0, 0));
brdr1.setTop(vbx1);
/**
@@ -95,28 +98,25 @@ public class BankGUI extends Player{
*
*/
b1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
int withdraw = Integer.parseInt(txtField1.getText());
if(withdraw < 0){
l5.setText("Come on " + getName() + ", are you trying to fool me?\nNo negative numbers please!");
}
else if (withdraw <= getBank()) {
setMoney(withdraw + getMoney());
setBank(getBank() - withdraw);
}
else {
l5.setText("Sorry, you can not withdraw that much.");
}
l2.setText("Balance: " + getBank());
l4.setText("Cash: " + getMoney());
}
catch (Exception e) {
l5.setText("Please enter a valid response.");
}
}
@Override
public void handle(ActionEvent event) {
try {
int withdraw = Integer.parseInt(txtField1.getText());
if (withdraw < 0) {
l5.setText("Come on " + getName() + ", are you trying to fool me?\nNo negative numbers please!");
} else if (withdraw <= getBank()) {
setMoney(withdraw + getMoney());
setBank(getBank() - withdraw);
} else {
l5.setText("Sorry, you can not withdraw that much.");
}
l2.setText("Balance: " + getBank());
l4.setText("Cash: " + getMoney());
} catch (Exception e) {
l5.setText("Please enter a valid response.");
}
}
}
);
/**
@@ -125,28 +125,26 @@ public class BankGUI extends Player{
*/
// Set the event handler when the withdraw button is clicked
b2.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
int deposit = Integer.parseInt(txtField1.getText());
if(deposit < 0){
l5.setText("Nice try! You can not enter negative numbers.");
}
else if (deposit <= getMoney()) {
setBank(deposit + getBank());
setMoney(getMoney() - deposit);
} else {
l5.setText("Sorry, you can not deposit that much.");
}
l2.setText("Balance: " + getBank());
l4.setText("Cash: " + getMoney());
}
catch (Exception e) {
l5.setText("Please enter a valid response.");
}
}
@Override
public void handle(ActionEvent event) {
try {
int deposit = Integer.parseInt(txtField1.getText());
if (deposit < 0) {
l5.setText("Nice try! You can not enter negative numbers.");
} else if (deposit <= getMoney()) {
setBank(deposit + getBank());
setMoney(getMoney() - deposit);
} else {
l5.setText("Sorry, you can not deposit that much.");
}
l2.setText("Balance: " + getBank());
l4.setText("Cash: " + getMoney());
} catch (Exception e) {
l5.setText("Please enter a valid response.");
}
}
}
);
/**
@@ -154,13 +152,13 @@ public class BankGUI extends Player{
*
*/
b3.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
TaipanShopGUI shopGUI = new TaipanShopGUI(getPlayer());
shopGUI.initializeShop(primaryStage);
primaryStage.show();
}
}
@Override
public void handle(ActionEvent event) {
TaipanShopGUI shopGUI = new TaipanShopGUI(getPlayer());
shopGUI.initializeShop(primaryStage);
primaryStage.show();
}
}
);

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
@@ -5,6 +7,7 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import logic.Player;
/**
* 2019-03-10
@@ -12,7 +15,7 @@ import javafx.stage.Stage;
* GameEndGUI class, Initializes and displays the graphical interface for when you lose
*
*/
public class GameEndGUI extends Player{
public class GameEndGUI extends Player {
private Label title;
private VBox vBox;

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
@@ -10,6 +12,7 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import logic.Player;
/**
* 2019-03-10

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.application.Application;
import javafx.stage.Stage;

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
@@ -5,6 +7,7 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import logic.Player;
import java.util.Random;
@@ -15,7 +18,7 @@ import java.util.Random;
* liu yen asking for money and to purchase a gun.
*/
public class RandomEventGUI extends Player{
public class RandomEventGUI extends Player {
private HBox hBox;
private Button yesButton;

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.animation.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
@@ -14,10 +16,14 @@ import javafx.scene.layout.VBox;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.util.Duration;
import java.io.FileInputStream;
import java.util.Random;
//Importing the logic classes required for this class
import logic.Player;
import logic.ShipWarfareLogic;
/**
* 2019-03-10 (Edited on 2019-03-23)
* Author: Haris Muhammad

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
@@ -8,6 +10,8 @@ import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import logic.Player;
import logic.FileSaving;
/**
* 2019-03-10
@@ -17,7 +21,7 @@ import javafx.stage.Stage;
*/
public class StartGUI extends Player{
public class StartGUI extends Player {
private BorderPane borderPane = new BorderPane();
private HBox hBox = new HBox();

View File

@@ -1,4 +1,4 @@
/**
package gui; /**
* TaipanShopGUI deals with setting the stage for shop.
*
* Author: Vikram Bawa
@@ -19,8 +19,11 @@ import javafx.scene.shape.Rectangle;
import javafx.scene.shape.StrokeType;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import logic.FileSaving;
import logic.Player;
import logic.TaipanShopLogic;
public class TaipanShopGUI extends Player{
public class TaipanShopGUI extends Player {
private Label firm = new Label();
private Label wItemsText = new Label();
private Label wItemSpaceText = new Label();
@@ -51,7 +54,7 @@ public class TaipanShopGUI extends Player{
*
* @param player is a Player object that will be copied and the player instance variable is set to the copy.
*/
public TaipanShopGUI(Player player) {
public TaipanShopGUI(logic.Player player) {
Player playerDummy = new Player(player);
setPlayer(playerDummy);
}

View File

@@ -1,4 +1,4 @@
/**
package gui; /**
* TravelGUI is the class in which takes the player from location to location
*
* Author: Harkamal Randhawa
@@ -9,19 +9,14 @@ import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.StrokeType;
import javafx.stage.Stage;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import logic.Player;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Random;
public class TravelGUI extends Player{
public class TravelGUI extends Player {
private TaipanShopGUI shop;
private Label firm = new Label();
private Label wItemsText = new Label();

View File

@@ -1,3 +1,5 @@
package gui;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
@@ -6,6 +8,7 @@ import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import logic.Player;
/**
* 2019-03-19
@@ -13,7 +16,7 @@ import javafx.stage.Stage;
* WarehouseGUI allows the user to store goods in a warehouse in order to have more hold on the ship
*/
public class WarehouseGUI extends Player{
public class WarehouseGUI extends Player {
//Create the labels, buttons and textfields required
private HBox hBox;
private VBox vBox;

View File

@@ -1,3 +1,5 @@
package logic;
import java.io.*;
/**
* 2019-03-10 (Edited on 2019-03-19)

View File

@@ -1,3 +1,5 @@
package logic;
import java.io.Serializable;
/**

View File

@@ -1,3 +1,5 @@
package logic;
import java.util.Random;
/**

View File

@@ -1,4 +1,4 @@
/**
package logic; /**
* TaipanShopLogic deals with the computations necessary for the shop such as randomizing prices.
*
* Author: Vikram Bawa

View File

@@ -1,6 +1,9 @@
package tests;
import static org.junit.Assert.*;
import logic.Player;
import org.junit.Assert;
import org.junit.Test;
import java.io.*;
@@ -21,7 +24,7 @@ public class PlayerTest {
@Test
public void getCargoSpace() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 60, player.getCargoSpace());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 60, player.getCargoSpace());
}
/**
@@ -31,7 +34,7 @@ public class PlayerTest {
public void setCargoSpace() {
Player player = new Player();
player.setCargoSpace(10);
assertEquals("The instance variable for the object does not line up with the rest of the class", 10, player.getCargoSpace());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 10, player.getCargoSpace());
}
/**
@@ -40,7 +43,7 @@ public class PlayerTest {
@Test
public void getAttackingShips() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getAttackingShips());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getAttackingShips());
}
/**
@@ -50,7 +53,7 @@ public class PlayerTest {
public void setAttackingShips() {
Player player = new Player();
player.setAttackingShips(false);
assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getAttackingShips());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getAttackingShips());
}
/**
@@ -59,7 +62,7 @@ public class PlayerTest {
@Test
public void getRetire() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getRetire());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getRetire());
}
/**
@@ -69,7 +72,7 @@ public class PlayerTest {
public void setRetire() {
Player player = new Player();
player.setRetire(true);
assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getRetire());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getRetire());
}
/**
@@ -78,7 +81,7 @@ public class PlayerTest {
@Test
public void getName() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", "Taipan", player.getName());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", "Taipan", player.getName());
}
/**
@@ -88,7 +91,7 @@ public class PlayerTest {
public void setName() {
Player player = new Player();
player.setName("a");
assertEquals("The instance variable for the object does not line up with the rest of the class", "a", player.getName());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", "a", player.getName());
}
/**
@@ -97,7 +100,7 @@ public class PlayerTest {
@Test
public void getHP() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 100, player.getHP());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 100, player.getHP());
}
/**
@@ -107,7 +110,7 @@ public class PlayerTest {
public void setHP() {
Player player = new Player();
player.setHP(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getHP());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getHP());
}
/**
@@ -116,7 +119,7 @@ public class PlayerTest {
@Test
public void getBank() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getBank());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getBank());
}
/**
@@ -126,7 +129,7 @@ public class PlayerTest {
public void setBank() {
Player player = new Player();
player.setBank(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getBank());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getBank());
}
/**
@@ -135,7 +138,7 @@ public class PlayerTest {
@Test
public void getMoney() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getMoney());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getMoney());
}
/**
@@ -145,7 +148,7 @@ public class PlayerTest {
public void setMoney() {
Player player = new Player();
player.setMoney(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getMoney());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getMoney());
}
/**
@@ -154,7 +157,7 @@ public class PlayerTest {
@Test
public void getOpiumHeld() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getOpiumHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getOpiumHeld());
}
/**
@@ -164,7 +167,7 @@ public class PlayerTest {
public void setOpiumHeld() {
Player player = new Player();
player.setOpiumHeld(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumHeld());
}
/**
@@ -173,7 +176,7 @@ public class PlayerTest {
@Test
public void getSilkHeld() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getSilkHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getSilkHeld());
}
/**
@@ -183,7 +186,7 @@ public class PlayerTest {
public void setSilkHeld() {
Player player = new Player();
player.setSilkHeld(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkHeld());
}
/**
@@ -192,7 +195,7 @@ public class PlayerTest {
@Test
public void getGeneralHeld() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getGeneralHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getGeneralHeld());
}
/**
@@ -202,7 +205,7 @@ public class PlayerTest {
public void setGeneralHeld() {
Player player = new Player();
player.setGeneralHeld(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralHeld());
}
/**
@@ -211,7 +214,7 @@ public class PlayerTest {
@Test
public void getArmsHeld() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getArmsHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getArmsHeld());
}
/**
@@ -221,7 +224,7 @@ public class PlayerTest {
public void setArmsHeld() {
Player player = new Player();
player.setArmsHeld(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsHeld());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsHeld());
}
/**
@@ -230,7 +233,7 @@ public class PlayerTest {
@Test
public void getLocation() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getLocation());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getLocation());
}
/**
@@ -240,7 +243,7 @@ public class PlayerTest {
public void setLocation() {
Player player = new Player();
player.setLocation(2);
assertEquals("The instance variable for the object does not line up with the rest of the class", 2, player.getLocation());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 2, player.getLocation());
}
/**
@@ -249,7 +252,7 @@ public class PlayerTest {
@Test
public void getGuns() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 5, player.getGuns());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 5, player.getGuns());
}
/**
@@ -259,7 +262,7 @@ public class PlayerTest {
public void setGuns() {
Player player = new Player();
player.setGuns(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGuns());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGuns());
}
/**
@@ -268,7 +271,7 @@ public class PlayerTest {
@Test
public void getDebt() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getDebt());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getDebt());
}
/**
@@ -278,7 +281,7 @@ public class PlayerTest {
public void setDebt() {
Player player = new Player();
player.setDebt(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getDebt());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getDebt());
}
/**
@@ -287,7 +290,7 @@ public class PlayerTest {
@Test
public void getwOpium() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwOpium());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwOpium());
}
/**
@@ -297,7 +300,7 @@ public class PlayerTest {
public void setwOpium() {
Player player = new Player();
player.setwOpium(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwOpium());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwOpium());
}
/**
@@ -306,7 +309,7 @@ public class PlayerTest {
@Test
public void getwSilk() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwSilk());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwSilk());
}
/**
@@ -316,7 +319,7 @@ public class PlayerTest {
public void setwSilk() {
Player player = new Player();
player.setwSilk(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwSilk());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwSilk());
}
/**
@@ -325,7 +328,7 @@ public class PlayerTest {
@Test
public void getwGeneral() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwGeneral());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwGeneral());
}
/**
@@ -335,7 +338,7 @@ public class PlayerTest {
public void setwGeneral() {
Player player = new Player();
player.setwGeneral(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwGeneral());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwGeneral());
}
/**
@@ -344,7 +347,7 @@ public class PlayerTest {
@Test
public void getwArms() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwArms());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwArms());
}
/**
@@ -354,7 +357,7 @@ public class PlayerTest {
public void setwArms() {
Player player = new Player();
player.setwArms(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwArms());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwArms());
}
/**
@@ -363,7 +366,7 @@ public class PlayerTest {
@Test
public void getOpiumPrice() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 16000, player.getOpiumPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 16000, player.getOpiumPrice());
}
/**
@@ -373,7 +376,7 @@ public class PlayerTest {
public void setOpiumPrice() {
Player player = new Player();
player.setOpiumPrice(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumPrice());
}
/**
@@ -382,7 +385,7 @@ public class PlayerTest {
@Test
public void getSilkPrice() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 1600, player.getSilkPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1600, player.getSilkPrice());
}
/**
@@ -392,7 +395,7 @@ public class PlayerTest {
public void setSilkPrice() {
Player player = new Player();
player.setSilkPrice(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkPrice());
}
/**
@@ -401,7 +404,7 @@ public class PlayerTest {
@Test
public void getArmsPrice() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 160, player.getArmsPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 160, player.getArmsPrice());
}
/**
@@ -411,7 +414,7 @@ public class PlayerTest {
public void setArmsPrice() {
Player player = new Player();
player.setArmsPrice(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsPrice());
}
/**
@@ -420,7 +423,7 @@ public class PlayerTest {
@Test
public void getGeneralPrice() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 8, player.getGeneralPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 8, player.getGeneralPrice());
}
/**
@@ -430,7 +433,7 @@ public class PlayerTest {
public void setGeneralPrice() {
Player player = new Player();
player.setGeneralPrice(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralPrice());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralPrice());
}
/**
@@ -439,7 +442,7 @@ public class PlayerTest {
@Test
public void getIsPriceChanged() {
Player player = new Player();
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getIsPriceChanged());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getIsPriceChanged());
}
/**
@@ -449,6 +452,6 @@ public class PlayerTest {
public void setIsPriceChanged() {
Player player = new Player();
player.setIsPriceChanged(1);
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getIsPriceChanged());
Assert.assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getIsPriceChanged());
}
}

View File

@@ -1,3 +1,7 @@
package text;
import logic.Player;
public class BankText extends Player {
public BankText(Player player) {
Player playerDummy = new Player(player);

View File

@@ -1,3 +1,8 @@
package text;
import logic.Player;
import logic.ShipWarfareLogic;
import java.util.Scanner;
import java.util.Random;
import java.util.concurrent.TimeUnit;

View File

@@ -1,10 +1,16 @@
package text;
import java.util.Scanner;
import logic.Player;
import logic.TaipanShopLogic;
/**
* TaipanShopText deals with the text based version of the shop.
*
* Author: Vikram Bawa
*/
import java.util.Scanner;
public class TaipanShopText extends Player{
public class TaipanShopText extends Player {
/**
* This method is evoked if the user is eligible to win, and chooses to end the game (by winning).
*/

View File

@@ -1,4 +1,7 @@
public class TravelText extends Player{
package text;
import logic.Player;
public class TravelText extends Player {
public TravelText(Player player) {
Player playerDummy = new Player(player);

View File

@@ -1,3 +1,7 @@
package text;
import logic.Player;
public class WarehouseText extends Player {
public WarehouseText(Player player) {
Player playerDummy = new Player(player);

View File

@@ -1,4 +1,8 @@
public class loanSharkText extends Player{
package text;
import logic.Player;
public class loanSharkText extends Player {
public loanSharkText(Player player) {
Player playerDummy = new Player(player);
setPlayer(playerDummy);