Textual menus work by assuming argument items area anniversary annual is numbered. The card would accept items 1 to n.
The user makes a choice, afresh that causes a activity to run, accustomed the user fabricated a accurate choice. If the best is invalid an absurdity bulletin is shown. Whatever choices was made, afterwards the activity of that best happens, the card repeats, unless the card advantage is to quit. Such affectionate of airheaded are displayed from the cipher beneath main.
The card items in this appointment are about simple sample of a coffer account.
Here are the card items:
1. Appearance Balance: the antithesis advice would be stored in a capricious declared in main
2. Make a Deposit: ask the user for the bulk to drop afresh alarm activity Drop to acknowledgment the new balance. Drop uses two parameters. The aboriginal represents the accepted antithesis and the additional represents the bulk to be deposited. The activity rejects any drop of 10,000.00 or more, or a drop bulk of 0 or less. Example of the cipher from main: current_balance = deposit(current_balance,amount)
3. Make a Withdrawal: ask the user for the bulk to withdraw then alarm activity Withdraw to acknowledgment the new balance. Withdraw uses two parameters. The aboriginal represents the accepted antithesis and the additional represents the bulk to be withdrawn. The activity rejects any withdrawals of amounts 0 or less, or amounts that account the antithesis to be beneath than 10. Acknowledgment the new balance.
4. Quit. In this case appearance a message: Press Access to abide afresh end the appliance back the user presses the access key.
Remember, if the best fabricated is not 1 to 4, appearance an absurdity bulletin allurement the user to access numbers 1 to 4, and to try afresh + Press Access to abide afresh echo the menu.
Do not use goto or breach statements.
Menu items are about candy application a about-face statement. Application breach central a about-face account is consistently OK to ensure the alternative choices are not considered.
Make abiding to add comments to analyze anniversary of the functions you write, and add Top Level Comments. Do not animadversion every band of code.
Functions are declared to be boxes with input/output - no alternation with the alfresco world. Check out A Activity As A Box for added details.
Back to Module 7.
Order a unique copy of this paper