Create a console-based lottery game application named Lottery. Generate three random numbers, each between 1 and 4. Allow the user to guess three numbers. Compare each of the user’s guesses to the three random numbers and display a message that includes the user’s guess, the randomly determined three-digit number, and the amount of money the user has won as follows:
Matching Numbers Award ($)
Any one matching 10
Two matching 100
Three matching, not in order 1000
Three matching in exact order 10,000
No matches 0
Make certain that your application accommodates repeating digits. For example, if a user guesses 1, 2, and 3, and the randomly generated digits are 1, 1, and 1, do not give the user credit for three correct guesses—just one.
Create a GUI application named LotteryGUI that lets the user play the Lottery game described in Exercise 9a.
In a “You Do It” section of this chapter, you created a tipping table for patrons to use when analyzing their restaurant bills. Now, create a modified program named TippingTable2 in which each of the following values is obtained from user input:
• The lowest tipping percentage
• The highest tipping percentage
• The lowest possible restaurant bill
• The highest restaurant bill
10. b. Create a GUI application named TippingTable2GUI that creates a tipping table after the user clicks a button. Get the lowest and highest tipping percentages and the lowest and highest restaurant bills from TextBox entries. The application should look similar to Figure 5-28.
Figure 5-28: Typical execution of TippingTable2GUI program
Write a program named Commission that computes commissions for automobile salespeople based on the value of a car sold. Salespeople receive 5 percent of the sale price for any car sold for up to and including $15,000; 7 percent for any car over $15,000 up to and including $24,000; and 10 percent of the sale price of any car over $24,000. Write a program that allows a user to enter a car price. The output is the salesperson’s commission.