bunch of revisions, still in progress
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import java.sql.SQLOutput;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Bank{
|
||||
@@ -6,47 +7,62 @@ public class Bank{
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
public Bank(Player player){
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
public Bank(Player player){
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public int promtMoney() {
|
||||
int addVal = 0;
|
||||
int retVal = 0;
|
||||
System.out.println("Please enter an amount");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
addVal = keyboard.nextInt();
|
||||
if(addVal >= 0) {
|
||||
retVal = addVal;
|
||||
public void bank(){
|
||||
Scanner input = new Scanner(System.in);
|
||||
boolean notDone = true;
|
||||
int check = 0;
|
||||
while(notDone){
|
||||
System.out.println("Would you like to Withdraw or Deposit?");
|
||||
String response = input.nextLine();
|
||||
if(response.equalsIgnoreCase("W")){
|
||||
boolean notDone2 = true;
|
||||
while(notDone2){
|
||||
int withdraw = input.nextInt();
|
||||
if(withdraw <= player.getBank()){
|
||||
player.setMoney(withdraw + player.getMoney());
|
||||
player.setBank(player.getBank()-withdraw);
|
||||
notDone2 = false;
|
||||
check = 1;
|
||||
}
|
||||
}
|
||||
}else if(response.equalsIgnoreCase("D")){
|
||||
boolean notDone2 = true;
|
||||
while(notDone2){
|
||||
int deposit = input.nextInt();
|
||||
if(deposit <= player.getMoney()){
|
||||
player.setBank(deposit + player.getBank());
|
||||
player.setMoney(player.getMoney()-deposit);
|
||||
notDone2 = false;
|
||||
check = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(check == 1){
|
||||
boolean notDone3 = true;
|
||||
while(notDone3){
|
||||
System.out.println("Would you like to continue? Y/N");
|
||||
response = input.nextLine();
|
||||
if(response.equalsIgnoreCase("Y")){
|
||||
notDone3 = false;
|
||||
}else if(response.equalsIgnoreCase("N")){
|
||||
notDone = false;
|
||||
notDone3 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public void addMoney() {
|
||||
int addMon = promtMoney();
|
||||
if(addMon >= 0) {
|
||||
player.setBank(promtMoney() + player.getMoney());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeMoney() {
|
||||
int subMon = promtMoney();
|
||||
if(subMon <= player.getMoney()) {
|
||||
player.setBank(subMon - player.getMoney());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addInterest() {
|
||||
player.setBank((int)((player.getBank() * 1.01)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user