##### Differences

This shows you the differences between two versions of the page.

 cs-142:cougar-cash [2015/05/11 14:51]cs142ta created cs-142:cougar-cash [2015/05/12 13:11]cs142ta 2015/05/12 13:11 cs142ta 2015/05/11 14:51 cs142ta 2015/05/11 14:51 cs142ta created Next revision Previous revision 2015/05/12 13:11 cs142ta 2015/05/11 14:51 cs142ta 2015/05/11 14:51 cs142ta created Line 3: Line 3: *Everyday you go to the BYU Candy Counter and buy chocolate covered cinnamon bears using your Cougar Cash card. *Everyday you go to the BYU Candy Counter and buy chocolate covered cinnamon bears using your Cougar Cash card. *Write a program which prompts the user how much they want to spend on candy, and then prints out the card balance and what cash is still owed. *Write a program which prompts the user how much they want to spend on candy, and then prints out the card balance and what cash is still owed. - *The initial card balance is$10.00. + *The initial card balance is$10.00. *Any purchase greater than what is on the card should use up the balance on the card. *Any purchase greater than what is on the card should use up the balance on the card. ==Solution== ==Solution== + /* + Test Case 1: + Input: 8.50 (input less than initial balance) + Output: balance is 1.50 + Actual: balance is 1.50 + + Test Case 2: + Input: 15.00 (input greater than initial balance) + Output: balance is 0, owes 5.00 + Actual: balance is 0, owes 5.00 + + Test Case 3: + Input: 0 (border case) + Output: balance is 10 + Actual: balance is 10 + */ + #include <​iostream>​ #include <​iostream>​ #include <​iomanip>​ #include <​iomanip>​