Exercise 3

For your birthday, you received $10 gift certificate for an online music store. You can buy songs until your money is gone. Write a C++ program that allows a user to repeatedly buy songs from your online music store. The initial balance is $10. For simplicity, we will just input from the user the cost of the song (usually $0.99, $1.99 or $2.99) and ignore the song name and artist name. Exit the loop when the user doesn't have enough money to buy more songs and display the remaining balance. A sample output looks like the following:

Enter the cost of the song, ($0.99, $1.99, or $2.99): 0.99
Your remining balance is: 9.01.
Enter the cost of the song, ($0.99, $1.99, or $2.99): 1.99
Your remining balance is: 7.02.
Enter the cost of the song, ($0.99, $1.99, or $2.99): 0.99
Your remining balance is: 6.03.
Enter the cost of the song, ($0.99, $1.99, or $2.99): 2.99
Your remining balance is: 3.04.
Enter the cost of the song, ($0.99, $1.99, or $2.99): 2.99
Your remining balance is: 0.05.
Sorry, balance is $0.05. You can't buy more songs.