A menu-driven program is one in which the user is presented with a list of choices, and must continue to pick a choice until they quit. For this program, each choice will correspond to an operation. Then the program will perform the operation, including getting any additional input that is needed. Here is a sample run to show you how each transaction is supposed to work. In the actual program, the user can choose the operations in any order, as many different times as s/he wants.
Please choose an operation: 0) quit 1) letters 2) rectangle 3) graph choice -> 1 enter two letters: M b B C D E F G H I J K L M Please choose an operation: 0) quit 1) letters 2) rectangle 3) graph choice -> 2 enter height, width & display character: 3 8 $ $$$$$$$$ $$$$$$$$ $$$$$$$$ Please choose an operation: 0) quit 1) letters 2) rectangle 3) graph choice -> 3 enter all the numbers to process on one line: 23 14 4 20 8 *********************** ************** **** ******************** ******** Please choose an operation: 0) quit 1) letters 2) rectangle 3) graph choice -> 0 BYE!
We will use the iterative development approach again. Try to finish all phases, but you do NOT have to stay beyond the scheduled 3 hours of lab! Remember to switch roles after each phase is completed.
Phase I: Write a program which repeatedly displays the transaction menu and reads an option from the user until they quit. Do not write the code to process any transactions yet, except to output one word indicating which operation was chosen.
Phase II: Add to the program so that it correctly processes the first operation - the letters transaction. First get it to work if the characters are input in the correct order, in upper case. Then add processing to handle the cases where they are not both given in upper case, or in the correct order.
Phase III: Add processing for the second operation - the rectangle transaction.
Phase IV: Add processing for the third transaction type - bar graph. Hint: you can initialize a Scanner object with a String. Use this to get all the numbers on the line. First get this operation working so that it just prints the numbers, one per line. Then change it so that it prints a string of stars instead, where the number of stars corresponds to the value.
Phase V: For an extra challenge, update the second operation so that it displays the outline of the rectangle, instead of a solid block of characters.
**************************************************
MAKE SURE YOU DELETE YOUR FILES OFF THE LAB COMPUTER WHEN DONE!!!
FAILURE TO DO SO IS AN ETHICS VIOLATION!
(Save on a flash drive or in email first.)
**************************************************