You are on page 1of 3

Question 1

1.

Write a program that maintains a high score table of five entries, where each entry is made up of a player's name and score. The table should store the entries in order, from highest score to lowest. Your program should initialize the table using your name and 1000 for all five entries. Next, your program should display the entries and allow a player to add a new one. Your program should accept a name and a score for the potential new entry. If the score is greater than or equal to the lowest score in the table, your program should insert the new entry at the correct position, adjust the rest of the table accordingly, and display a message saying that the entry was inserted. Otherwise, your program should display a message telling the player that the score was too low for the entry to be added. Your program should continue to display the table and allow the player to add new entries as long as he or she wants. *Hint 1: Your program doesn't have to do a full sort of the entries when a new one is added. You can assume that the entries are already sorted; a new entry needs only to be inserted at the correct position with the rest of the table adjusted accordingly) *Hint 2: You must use an array(s) and loop(s).
Answer 1. Attach File Attach Local File 25 points

Question 2
1.

Write a program that displays all of the cards from a deck of playing cards. The program should use either "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", or "K" for the rank of the card and either 'c', 'h', 's', or 'd' for the suit. So if the program randomly selects the jack of clubs, it should display Jc. Use an array of string objects for the ranks and another array of char values for the suits. The program should display: 2c 3c
4c 5c

2h 3h 4h 5h

2s 3s 4a 5s

2d 3d 4d 5d

6c 7c 8c 9c 10c Jc Qc Kc Ac

6h 7h 8h 9h 10h Jh Qh Kh Ah

6s 7s 8s 9s 10s Js Qs Ks As

6d 7d 8d 9d 10d Jd Qd Kd Ad

Answer 1. Attach File Attach Local File 40 points

Question 3
1.

A student has established the following monthly budget: Housing 500.00 Utilities 150.00 Household Expenses 65.00 Transportation 50.00 Food 250.00 Medical 30.00 Insurance 100.00 Entertainment 150.00 Clothing 75.00 Miscellaneous 50.00 Write a modular program that declares a MonthlyBudget structure with member variables to hold each of these expense categories. The program should create two MonthlyBudget structure variables. The first will hold the budget figures given above. The second will hold the user-enter amounts actually spent during the past month. The program should create a screen form that displays each category name and its budgeted amount, then positions the cursor next to it for the user to enter the amount

actually spent in that category. Once the user data has all been entered, the program should compute and display the amount over or under budget the student's expenditures were in each category, as well as the amount over or under budget for the entire month.

You might also like