Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of
https://github.uconn.edu/joh13010/2102-Group-Project-Spring-2017.git

Conflicts:
	bin/model/CharityTile.class
	bin/model/ChildTile.class
	bin/model/DoodadTile.class
	bin/model/FinancialStatement.class
  • Loading branch information
Joe Hill committed Apr 7, 2017
2 parents 6be43b9 + 9a99d87 commit afdcd50
Show file tree
Hide file tree
Showing 19 changed files with 441 additions and 5 deletions.
Binary file modified bin/controller/Cashflow.class
Binary file not shown.
Binary file modified bin/model/BigDealStack.class
Binary file not shown.
Binary file modified bin/model/CharityTile.class
Binary file not shown.
Binary file modified bin/model/ChildTile.class
Binary file not shown.
Binary file modified bin/model/DealCard.class
Binary file not shown.
Binary file modified bin/model/DoodadCard.class
Binary file not shown.
Binary file modified bin/model/DoodadStack.class
Binary file not shown.
Binary file modified bin/model/DoodadTile.class
Binary file not shown.
Binary file modified bin/model/FinancialStatement.class
Binary file not shown.
Binary file modified bin/model/SmallDealStack.class
Binary file not shown.
6 changes: 2 additions & 4 deletions src/model/CharityTile.java
Expand Up @@ -12,15 +12,13 @@ public class CharityTile extends Tile
@Override
public void getLandedOn(Player p)
{

//call view method
// TODO
// Ask players if they want to donate to charity (returns boolean)

if (p.donateCharity())
{
p.setCharityCount(p.getCharityCount() + 3);
p.getFinancialStatement().setCashBalance(p.getFinancialStatement().getCashBalance()
- (p.getFinancialStatement().getPassiveIncome()*.10));
p.getFinancialStatement().increaseCashBalance((int) -((p.getFinancialStatement().getTotalIncome()*.1)));
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/model/ChildTile.java
Expand Up @@ -12,6 +12,7 @@ public class ChildTile extends Tile
public void getLandedOn(Player p)
{
p.getFinancialStatement().addChild();
p.getFinancialStatement().update();

}

Expand Down
2 changes: 2 additions & 0 deletions src/model/DoodadTile.java
Expand Up @@ -20,10 +20,12 @@ public class DoodadTile extends Tile
if (p.getFinancialStatement().getCashBalance() > amount)
{
p.getFinancialStatement().setCashBalance(p.getFinancialStatement().getCashBalance() - amount);
p.getFinancialStatement().update();
}
else if(p.getFinancialStatement().getCashBalance() < amount)
{
p.getFinancialStatement().setCashBalance(0);
p.getFinancialStatement().update();
}
// Pop next card
// Get cash out from card
Expand Down
6 changes: 5 additions & 1 deletion src/model/FinancialStatement.java
Expand Up @@ -91,7 +91,7 @@ public class FinancialStatement
update();
}

private void update()
public void update()
{
_income = _salary + _REcashFlow;
_expenses = _taxes + _homeMortgagePayment + _schoolLoanPayment + _carLoanPayment + _creditCardPayment + _otherExpenses + (_perChildExpense * _numChildren);
Expand Down Expand Up @@ -199,6 +199,10 @@ public class FinancialStatement
{
return _profession;
}
public int getTotalIncome()
{
return _totalIncome;
}
}


Expand Down
94 changes: 94 additions & 0 deletions src/view/CharityCard.java
@@ -0,0 +1,94 @@
package view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class CharityCard {
private JFrame mainFrame;
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;

public CharityCard(){
prepareGUI();
}
public static void main(String[] args){
CharityCard CharityCard = new CharityCard();
CharityCard.showButtonDemo();
}
private void prepareGUI(){
mainFrame = new JFrame("Charity");
mainFrame.setSize(400,250);
//need to set this to null and position everything manually
mainFrame.setLayout(new GridLayout(3, 1));

mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
headerLabel = new JLabel("", JLabel.CENTER);
statusLabel = new JLabel("",JLabel.CENTER);
//new statuslabel of "10% of your whatever is XX dollars"
statusLabel.setSize(350,100);

controlPanel = new JPanel();
controlPanel.setLayout(new FlowLayout());

mainFrame.add(headerLabel);
mainFrame.add(controlPanel);
mainFrame.add(statusLabel);
mainFrame.setVisible(true);
}
private static ImageIcon createImageIcon(String path, String description) {
java.net.URL imgURL = CharityCard.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
private void showButtonDemo(){
headerLabel.setText("Charity!");
statusLabel.setText("Charity description");

//resources folder should be inside SWING folder.
ImageIcon icon = createImageIcon("/resources/java_icon.png","Java");

JButton Donate = new JButton("Donate");

JButton DontDonate = new JButton("Don't Donate", icon);
DontDonate.setHorizontalTextPosition(SwingConstants.LEFT);

Donate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//put message that they donated xx dollars after 10 seconds, close window
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

statusLabel.setText("Good Job! You donated all your savings!");


System.exit(0);
}
});

DontDonate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//put message that they are greedy. after 10 seconds, close window
System.exit(0);
}
});
controlPanel.add(Donate);

controlPanel.add(DontDonate);

mainFrame.setVisible(true);
}
}
71 changes: 71 additions & 0 deletions src/view/ChildCard.java
@@ -0,0 +1,71 @@
package view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ChildCard {

private JFrame mainFrame;
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;

public ChildCard(){
prepareGUI();
}
public static void main(String[] args){
ChildCard ChildCard = new ChildCard();
ChildCard.showButtonDemo();
}
private void prepareGUI(){
mainFrame = new JFrame("Child");
mainFrame.setSize(400,250);
//need to set this to null and position everything manually
mainFrame.setLayout(new GridLayout(3, 1));

mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
headerLabel = new JLabel("", JLabel.CENTER);
statusLabel = new JLabel("",JLabel.CENTER);
statusLabel.setSize(350,100);

controlPanel = new JPanel();
controlPanel.setLayout(new FlowLayout());

mainFrame.add(headerLabel);
mainFrame.add(controlPanel);
mainFrame.add(statusLabel);
mainFrame.setVisible(true);
}

private void showButtonDemo(){
headerLabel.setText("Child");
statusLabel.setText("You have a child!");

//resources folder should be inside SWING folder.

JButton Child = new JButton("Exit");

Child.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

statusLabel.setText("");

System.exit(0);
}
});

controlPanel.add(Child);
mainFrame.setVisible(true);
}
}
103 changes: 103 additions & 0 deletions src/view/DealCard.java
@@ -0,0 +1,103 @@
package view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import model.*;

public class DealCard {
private JFrame mainFrame;
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;
private JFrame mainFrame2;
private JLabel headerLabel2;
private JLabel statusLabel2;
private JPanel controlPanel2;
public int response;

public DealCard(){
prepareGUI();
}
public static void main(String[] args){
DealCard DealCard = new DealCard();
DealCard.showButtonDemo();
}
private void prepareGUI(){
mainFrame = new JFrame("Deal");
mainFrame.setSize(400,250);
//need to set this to null and position everything manually
mainFrame.setLayout(new GridLayout(3, 1));

mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
headerLabel = new JLabel("", JLabel.CENTER);
statusLabel = new JLabel("",JLabel.CENTER);
//new statuslabel of "10% of your whatever is XX dollars"
statusLabel.setSize(350,100);

controlPanel = new JPanel();
controlPanel.setLayout(new FlowLayout());

mainFrame.add(headerLabel);
mainFrame.add(controlPanel);
mainFrame.add(statusLabel);
mainFrame.setVisible(true);

mainFrame2 = new JFrame("Deal");
mainFrame2.setSize(400,250);
//need to set this to null and position everything manually
mainFrame2.setLayout(new GridLayout(3, 1));

mainFrame2.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
headerLabel2 = new JLabel("", JLabel.CENTER);
statusLabel2 = new JLabel("",JLabel.CENTER);
//new statusLabel2 of "10% of your whatever is XX dollars"
statusLabel2.setSize(350,100);

controlPanel2 = new JPanel();
controlPanel2.setLayout(new FlowLayout());

mainFrame2.add(headerLabel2);
mainFrame2.add(controlPanel2);
mainFrame2.add(statusLabel2);
mainFrame2.setVisible(true);
}

private int showButtonDemo(){

headerLabel.setText("Deal");
statusLabel.setText("What type of deal would you like?");

//resources folder should be inside SWING folder.

JButton BigDeal = new JButton("BigDeal");
JButton SmallDeal = new JButton("SmallDeal");
SmallDeal.setHorizontalTextPosition(SwingConstants.LEFT);

BigDeal.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//open big deal stuffs
response = 1;
}

});

SmallDeal.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
response = 0;
}
});
controlPanel.add(BigDeal);
controlPanel.add(SmallDeal);
mainFrame.setVisible(true);
return response;
}
}

0 comments on commit afdcd50

Please sign in to comment.