Java辅导:IAPP001 PayDay GUI辅导Java设计
- 首页 >> Java编程用Java代写一个选择题的答题器程序,练习基本的程序设计。
Specification
Build a GUI for a PayDay application. The domain or model tasks are described in Appendix A. The situations to be handled are listed in Appendix B.
The basic form of the GUI is a single window multiple panels. The general appearance and behaviour of the panels are described below; for more details about the system behaviour, see the task descriptions. As a general principle, your GUI should provide some form of feedback for every button press; the user should never have to guess whether the command succeeded or not. Assume that no typing errors are made; a user may enter an incorrect value such as a wrong session id, but that is not a typing error.
Main Window
The main window has two panels: the board panel amp; the control panel:
The board panel handles the player icons’ movement around the PayDay board - no changes are required for this panel.
The control panel has 2 panels: the roll panel amp; the boss panel:
The roll panel displays the jackpot amount and the dice rolls for the player and computer. The user clicks on the Play button to start a game.
The boss panel has 2 panels: the display panel amp; the system panel:
The display panel displays balances for the computer and player. The user clicks on the Change Player Name button and to change the player’s name. The system will display a separate window to allow the user to change a player’s name.
The system panel has 3 buttons, List Bills, Exit and Show. Exit closes the application, show calls game.show() for debugging purposes.
List Bill Window - HD task
The list of bills owed by each player are displayed in a separate window, including the amount and description.
The skeleton provides no code for this task. Changes will need to be made to the model for this task. This task is very difficult, do not attempt it until the base assignment has been completed.
Implementation
Skeleton code for the system can be downloaded from UTSOnline. Use the MVC and Observer code patterns where appropriate. The GUI classes must be in a separate package from the model classes, as in the skeleton code.
Appendix A: Domain task descriptions
Mini PayDay is a small simplified version of the board game PayDay. The board has 14 squares, 3 Chance squares (Sweepstakes, Lottery amp; Casino), 3 Mail squares, 4 Expense squares (Pay Rent, Fun Day, Buy Groceries amp; Pay School Fees), 2 Income Squares (Receive Dividend amp; Income Tax Rebate), a generic Square (Rest Day) and a PayDay square.
Here is the layout of the board:
There are 2 players; a manual player and the computer, each player starts with $1000 and rolls the dice moving from left to right, top to bottom.
Every time a player passes or lands on PayDay, they receive wages of $1000, pay any bills and pay interest on loans (at 10%). A player can take out loans in increments of $1000, if they do not have enough money. A player can pay off loans in increments of $1000, if they have enough money.
When a Player lands on a Chance square (SweepStakes, Lottery amp; Casino), the Player rolls the dice:
SweepStakes - the player wins $100* the dice roll
Lottery - the player wins $20*the dice roll
Casino - this is a special type of Chance square - the player rolls the dice, if the dice roll is odd the player wins $500. If the dice roll is even, the player loses $500 (the amount is placed in the jackpot kitty).
When a player lands on a Mail square, the system randomly picks a MailCard;
There are 5 possible MailCards:
Bill - Land rates bill due $2500
Ad - Get 20% off Foxtel
Bill - Telephone bill due $1200
PostCard - Nanna is having fun in Greece
Bill - Electricity bill due $ 900
If the Player receives a Bill, the bill is held and needs to be paid on PayDay. Any other MailCard is considered junk mail and is discarded.
When a Player lands on an Expense Square (Pay Rent, Fun Day, Buy Groceries amp; Pay School Fees), the player must pay the expense amount immediately.
Pay Rent - the player pays $600
Fun Day - the player pays $200
Buy Groceries - the player pays $300
Pay School Fees - the player pays $500
The amount paid by the player is placed in the jackpot kitty.
When a player lands on an Income Square (Receive Dividend amp; Income Tax Rebate), the player receives the income amount.
Receive Dividend - the player receives $400
Income Tax Rebate - the player receives $200
When a player lands on Rest Day (the generic Square), no action is taken.
When a player lands on the PayDay square, the player receive wages of $1000, pays any bills accumulated in the pay period (the bills are then discarded) and pays interest on any loans.
If the player does not have enough money, they must take out a loan (in increments of $1000).
If a Player has enough money, they must payoff any loans (in increments of $1000).
The player then moves to the Start position (position 0).
The game ends after 2 rounds have been played.
The tasks are described below; in each task description, the success or normal case is described first, then any special or error cases.
Add Player
A user must enter a name for the manual player. The player balance, loan amount and the board position of the player are held by the system.
Play
The dice is rolled and the player moves the designated number of spaces to the new space. Any required action is executed; any penalty or bonus is applied to the player’s balance and/or the jackpot balance.
Jackpot
If the player rolls a 6, they win the amount of money accumulated in the jackpot.
The jackpot amount is reset to 0. Jackpot is not won if player rolls a 6 on a Chance roll.
List Bills - HD Task
From time to time, the players want to know what bills they will need to pay on PayDay, and what bills the other players need to pay.
Appendix B: Situations to handle
Change Player Name.
The system shows label changes on Control panel amp; Display panel
Play
Win Jackpot
Pass PayDay
Game Over
Correct balances
List Bills
Correct order and layout
Appendix C: Example GUI Layout
Please note: In this layout I used confirm.setPreferredSize(new Dimension(400, 100)); to set the size of JTextArea confirm, otherwise the text area will resize with the text displayed.