button 3: joe gives $10 to bob. button 4: bob gives $5 to joe.
this is what my solution was:
private void joeGivesToBob_Click(object sender, EventArgs e) {
if (joe.Cash >= 10) {
bob.Cash = joe.GiveCash(10);
UpdateForm();
}
else {
MessageBox.Show("Joe is out of money.");
}
}
private void bobGivesToJoe_Click(object sender, EventArgs e) {
if (bob.Cash >= 5) {
joe.Cash = bob.GiveCash(5);
UpdateForm();
}
else {
MessageBox.Show("Bob is out of money.");
}
}
i understand the solution on page 120. but no where in the prior 119 pages does it discuss how i should have arrived at that solution.
I am painstakingly going thru every exercise in the book. how would I have known that that was the correct way to write the code for those 2 buttons?




Help





