-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
69 lines (54 loc) · 1.63 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using static System.Net.Mime.MediaTypeNames;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace Cash
{
public partial class Form1 : Form
{
static int BankCash = 100;
Guy Joe = new Guy("Joe", 50);
Guy Bob = new Guy("Bob", 100);
public Form1()
{
InitializeComponent();
}
public void ActualizaForm()
{
lblJoeCash.Text = Joe.getName() +" tiene "+ Joe.getCash()+ " euros";
lblBobCash.Text = Bob.getName() + " tiene " + Bob.getCash() + " euros";
lblBankCash.Text = "En el banco quedan " + BankCash + " euros";
}
public static void main(String[] args)
{
Form1 miFormulario = new Form1();
}
private void btnJoeReceiveCash_Click(object sender, EventArgs e)
{
if (BankCash >= 10)
{
BankCash = BankCash - 10;
Joe.setCash(Joe.getCash() + 10);
ActualizaForm();
}
else
{
MessageBox.Show("El banco no puede pasarle 10 euros a Joe");
}
}
private void btnBobGiveJoe_Click(object sender, EventArgs e)
{
}
private void btnBobGiveCash_Click(object sender, EventArgs e)
{
if (Bob.Cash >= 5)
{
Bob.Cash-= 5;
BankCash= BankCash + 5;
ActualizaForm();
}
else
{
MessageBox.Show("Bob no puede pasar 5 euros al banco");
}
}
}
}