Controlling Program Flow w/i an ATM Using selection statements & loops to complete the following: Validate...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Controlling Program Flow w/i an ATM Using selection statements & loops to complete the following: Validate the user's PIN -- only allow them to attempt three (3) times before ending the program If the PIN matched: O 。 Continuously prompt the user with menu options corresponding to the ATM's ○ functionality what options should we include here? ■ Suggestions: D: Deposit W: Withdraw Cash B: Display Current Balance P: Change PIN. о Must be length >= 4 && different from the previous Q: Program ends. Anything else: error message -- return to the main menu to try again. Read in the user's choice and use a switch statement to handle the appropriate functionality as suggested above To Do: Begin by downloading ATMMenu.java from CourseSite (Prep & Participation > Week 5 Resources). When you open this program, you will see that there is code written to display basic menu options for a menu-driven ATM system. You are going to complete the program to actually start implementing basic functionality for each menu option (included below): ATM Main Menu D: Deposit W: Withdraw Cash B: Display Current Balance P: Change PIN. Q: Program ends. 1. Begin by familiarizing yourself with the code provided. In the starting program, there are a handful of suggested variables declared (including a Scanner object). a. You may choose to use these variables to complete the requirements that follow, OR you can create your own. Either is fine. 2. Using selection statement(s) within a loop, you should write code to validate the user's PIN before prompting them with the menu options. a. Revisit the ATM activity from Week 3 for a hint about getting started with this. b. Note: the user should only have 3 chances to enter their PIN before being locked out. After that, end the program after sharing an error message. 3. After the PIN is validated, you should display the relevant menu options for the user. a. Note: there are print statements in the provided starting program with the menu options listed for the user (though you can/should move that code into an appropriate location based on intended program flow). 4. Prompt the user to select a menu option reading in the user's choice as a single character and validate the choice a. Validation: i. ii. If the user typed in a valid menu option ('D', 'W', ‘B', ‘P', ‘Q'), continue executing (go to step 5 below) Otherwise, if the user typed in something that was not valid, the program should display an error message and end. b. remember: there is no nextChar() method in the Scanner class. What options do we have to read in this data? 5. Use a switch statement to process the user's input to execute the correct path based on the user's valid input. Within each of these alternate paths of execution, there may be additional selection statements to utilize. i. ii. iii. iv. V. If the user enters 'D', the program should execute commands to deposit money into the machine. 1. Ask the user if they are depositing cash or checks, and for the amount. 2. Don't forget to change the user's current balance after depositing the money. If the user enters 'W', the program should prompt the user to select the amount of money that they want to withdraw 1. This number should be an integer/multiple of 20 2. Be sure that the user is not trying to withdraw more than they have available 3. Don't forget to change the user's current balance after depositing the money. If the user enters 'B', display their current balance (before displaying the menu again) If the user enters ‘P’, the program should execute the commands to change the current PIN 1. The new PIN must be at least 4 numeric digits long and cannot match the current PIN. 2. Be sure to let the user know which of those criteria fail, or that the PIN was successfully changed if both pass. If the user enters ‘Q', the program should display a message and end. 6. The program should continuously prompt the user to enter a choice until they type 'Q' 7. Requirements: a. Use at least one if-else Statement and one switch statement b. Use at least one of each type of loop (for, while, do while) Reminders: • THERE IS NO “RIGHT” ANSWER FOR THE ATM ACTIVITIES. You may choose to implement the program as you wish (as long as you are including any/all program requirements). If there is any functionality that you don't know how to implement using Java (yet), use a comment to describe what you are trying to do. Adhere to good programming practices (includes a header, comments, proper indentation, and descriptive variable names using camelCase) } public class ATMMenu{ Run | Debug public static void main(String[] args) { //1. verify the user's pin (allowing 3 incorrect attempts) //2. display the menu options and prompt the user to select a function //3. use a switch statement to evaluate the user's choice (or to tell them that they typed an incorrect value) //4. continuing prompting until the user types a 'Q' } System.out.println("ATM Main Menu"); System.out.println("D: Deposit"); System.out.println("W: Withdraw Cash"); System.out.println("B: Display Current Balance"); System.out.println("P: Change PIN."); System.out.println("Q: Program ends."); Controlling Program Flow w/i an ATM Using selection statements & loops to complete the following: Validate the user's PIN -- only allow them to attempt three (3) times before ending the program If the PIN matched: O 。 Continuously prompt the user with menu options corresponding to the ATM's ○ functionality what options should we include here? ■ Suggestions: D: Deposit W: Withdraw Cash B: Display Current Balance P: Change PIN. о Must be length >= 4 && different from the previous Q: Program ends. Anything else: error message -- return to the main menu to try again. Read in the user's choice and use a switch statement to handle the appropriate functionality as suggested above Controlling Program Flow w/i an ATM Using selection statements & loops to complete the following: Validate the user's PIN -- only allow them to attempt three (3) times before ending the program If the PIN matched: O 。 Continuously prompt the user with menu options corresponding to the ATM's ○ functionality what options should we include here? ■ Suggestions: D: Deposit W: Withdraw Cash B: Display Current Balance P: Change PIN. о Must be length >= 4 && different from the previous Q: Program ends. Anything else: error message -- return to the main menu to try again. Read in the user's choice and use a switch statement to handle the appropriate functionality as suggested above To Do: Begin by downloading ATMMenu.java from CourseSite (Prep & Participation > Week 5 Resources). When you open this program, you will see that there is code written to display basic menu options for a menu-driven ATM system. You are going to complete the program to actually start implementing basic functionality for each menu option (included below): ATM Main Menu D: Deposit W: Withdraw Cash B: Display Current Balance P: Change PIN. Q: Program ends. 1. Begin by familiarizing yourself with the code provided. In the starting program, there are a handful of suggested variables declared (including a Scanner object). a. You may choose to use these variables to complete the requirements that follow, OR you can create your own. Either is fine. 2. Using selection statement(s) within a loop, you should write code to validate the user's PIN before prompting them with the menu options. a. Revisit the ATM activity from Week 3 for a hint about getting started with this. b. Note: the user should only have 3 chances to enter their PIN before being locked out. After that, end the program after sharing an error message. 3. After the PIN is validated, you should display the relevant menu options for the user. a. Note: there are print statements in the provided starting program with the menu options listed for the user (though you can/should move that code into an appropriate location based on intended program flow). 4. Prompt the user to select a menu option reading in the user's choice as a single character and validate the choice a. Validation: i. ii. If the user typed in a valid menu option ('D', 'W', ‘B', ‘P', ‘Q'), continue executing (go to step 5 below) Otherwise, if the user typed in something that was not valid, the program should display an error message and end. To Do: Begin by downloading ATMMenu.java from CourseSite (Prep & Participation > Week 5 Resources). When you open this program, you will see that there is code written to display basic menu options for a menu-driven ATM system. You are going to complete the program to actually start implementing basic functionality for each menu option (included below): ATM Main Menu D: Deposit W: Withdraw Cash B: Display Current Balance P: Change PIN. Q: Program ends. 1. Begin by familiarizing yourself with the code provided. In the starting program, there are a handful of suggested variables declared (including a Scanner object). a. You may choose to use these variables to complete the requirements that follow, OR you can create your own. Either is fine. 2. Using selection statement(s) within a loop, you should write code to validate the user's PIN before prompting them with the menu options. a. Revisit the ATM activity from Week 3 for a hint about getting started with this. b. Note: the user should only have 3 chances to enter their PIN before being locked out. After that, end the program after sharing an error message. 3. After the PIN is validated, you should display the relevant menu options for the user. a. Note: there are print statements in the provided starting program with the menu options listed for the user (though you can/should move that code into an appropriate location based on intended program flow). 4. Prompt the user to select a menu option reading in the user's choice as a single character and validate the choice a. Validation: i. ii. If the user typed in a valid menu option ('D', 'W', ‘B', ‘P', ‘Q'), continue executing (go to step 5 below) Otherwise, if the user typed in something that was not valid, the program should display an error message and end. b. remember: there is no nextChar() method in the Scanner class. What options do we have to read in this data? 5. Use a switch statement to process the user's input to execute the correct path based on the user's valid input. Within each of these alternate paths of execution, there may be additional selection statements to utilize. i. ii. iii. iv. V. If the user enters 'D', the program should execute commands to deposit money into the machine. 1. Ask the user if they are depositing cash or checks, and for the amount. 2. Don't forget to change the user's current balance after depositing the money. If the user enters 'W', the program should prompt the user to select the amount of money that they want to withdraw 1. This number should be an integer/multiple of 20 2. Be sure that the user is not trying to withdraw more than they have available 3. Don't forget to change the user's current balance after depositing the money. If the user enters 'B', display their current balance (before displaying the menu again) If the user enters ‘P’, the program should execute the commands to change the current PIN 1. The new PIN must be at least 4 numeric digits long and cannot match the current PIN. 2. Be sure to let the user know which of those criteria fail, or that the PIN was successfully changed if both pass. If the user enters ‘Q', the program should display a message and end. 6. The program should continuously prompt the user to enter a choice until they type 'Q' 7. Requirements: a. Use at least one if-else Statement and one switch statement b. Use at least one of each type of loop (for, while, do while) b. remember: there is no nextChar() method in the Scanner class. What options do we have to read in this data? 5. Use a switch statement to process the user's input to execute the correct path based on the user's valid input. Within each of these alternate paths of execution, there may be additional selection statements to utilize. i. ii. iii. iv. V. If the user enters 'D', the program should execute commands to deposit money into the machine. 1. Ask the user if they are depositing cash or checks, and for the amount. 2. Don't forget to change the user's current balance after depositing the money. If the user enters 'W', the program should prompt the user to select the amount of money that they want to withdraw 1. This number should be an integer/multiple of 20 2. Be sure that the user is not trying to withdraw more than they have available 3. Don't forget to change the user's current balance after depositing the money. If the user enters 'B', display their current balance (before displaying the menu again) If the user enters ‘P’, the program should execute the commands to change the current PIN 1. The new PIN must be at least 4 numeric digits long and cannot match the current PIN. 2. Be sure to let the user know which of those criteria fail, or that the PIN was successfully changed if both pass. If the user enters ‘Q', the program should display a message and end. 6. The program should continuously prompt the user to enter a choice until they type 'Q' 7. Requirements: a. Use at least one if-else Statement and one switch statement b. Use at least one of each type of loop (for, while, do while) Reminders: • THERE IS NO “RIGHT” ANSWER FOR THE ATM ACTIVITIES. You may choose to implement the program as you wish (as long as you are including any/all program requirements). If there is any functionality that you don't know how to implement using Java (yet), use a comment to describe what you are trying to do. Adhere to good programming practices (includes a header, comments, proper indentation, and descriptive variable names using camelCase) Reminders: • THERE IS NO “RIGHT” ANSWER FOR THE ATM ACTIVITIES. You may choose to implement the program as you wish (as long as you are including any/all program requirements). If there is any functionality that you don't know how to implement using Java (yet), use a comment to describe what you are trying to do. Adhere to good programming practices (includes a header, comments, proper indentation, and descriptive variable names using camelCase) } public class ATMMenu{ Run | Debug public static void main(String[] args) { //1. verify the user's pin (allowing 3 incorrect attempts) //2. display the menu options and prompt the user to select a function //3. use a switch statement to evaluate the user's choice (or to tell them that they typed an incorrect value) //4. continuing prompting until the user types a 'Q' } System.out.println("ATM Main Menu"); System.out.println("D: Deposit"); System.out.println("W: Withdraw Cash"); System.out.println("B: Display Current Balance"); System.out.println("P: Change PIN."); System.out.println("Q: Program ends."); } public class ATMMenu{ Run | Debug public static void main(String[] args) { //1. verify the user's pin (allowing 3 incorrect attempts) //2. display the menu options and prompt the user to select a function //3. use a switch statement to evaluate the user's choice (or to tell them that they typed an incorrect value) //4. continuing prompting until the user types a 'Q' } System.out.println("ATM Main Menu"); System.out.println("D: Deposit"); System.out.println("W: Withdraw Cash"); System.out.println("B: Display Current Balance"); System.out.println("P: Change PIN."); System.out.println("Q: Program ends.");
Expert Answer:
Answer rating: 100% (QA)
Heres a basic implementation of the ATMMenu class based on the requirements provided import javautilScanner public class ATMMenu public static void ma... View the full answer
Related Book For
Principles of Managerial Finance
ISBN: 978-1408271582
Arab World Edition
Authors: Lawrence J. Gitman, Chad J. Zutter, Wajeeh Elali, Amer Al Roubaix
Posted Date:
Students also viewed these programming questions
-
Administrative Expense Budget Green Earth Landscaping Company provides monthly and weekly landscaping and maintenance services to residential customers in the tri-city area. Green Earth has no...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
for any work involving matrices, could you draw them out for me to visualize please? It would be much appreciated. 1. Consider the following set of four linear inequalities: A: x + y + z > 3 B: 2x -...
-
QUESTION 17 The moment of a force about a pivot point is; a. The force multiplied by the perpendicular distance fro the pivot point to the direction of the force b. the distance from the pivot to the...
-
For the bomb calorimeter described in Example 14.2, determine the maximum temperature the bomb would achieve if 20 g of apple juice and 0.005 g of fuse wire were burned.
-
(reverse linked list). This static method shall have one parameter that is a reference for a linked list of integers and shall return ahead reference to a linked list of integers in the reverse order...
-
Presented below are cash flow data for L.A. Gear Inc. During this period of time, the manufacturer of athletic shoes and sportswear experienced a 1200 percent growth in net income. Required 1....
-
Following are separate income statements for Austin, Inc., and its 80 percent owned subsidiary, Rio Grande Corporation as well as a consolidated statement for the business combination as a whole....
-
Please answer in 2paragraphs each. Describe some of the immigration laws of the United States and how they have changed over the years. The 1 st regulation of immigration was the Chinese Exclusion...
-
W&S Partners has just won the January 31, 2026, audit for Cloud 9. As a part of the risk assessment phase for the new audit, the audit team needs to gain an understanding of Cloud 9's structure and...
-
I attached the entire code but the only parts that need to be fixed are the def calc_movie_feature_matrix in class ContentBased, calc_item_item_similarity in class ContentBased, and predict_from_sim...
-
What methodologies and tools are commonly used to test and validate an RTOS? How can you ensure that the system meets real-time requirements under various conditions?
-
Using three years of ratios and information about Delta company, describe in a 2-3 page paper whether your companys performance or position has improved over the three-year period or has grown worse....
-
A weight is hung on the end of a spring and rests 50 cm above a table top. The weight is pulled down 25 cm and released at time t = 0. This creates a periodic up and down motion. It takes the weight...
-
Describe the process of integrating an RTOS into an embedded system. What considerations are there for hardware-specific dependencies, and how does the RTOS interact with various hardware components ?
-
Discuss the security implications of using an RTOS in critical applications. What are some common vulnerabilities, and how does the RTOS architecture address security concerns without compromising...
-
Using a determinate, find the moment due to the force along AB about the origin. Point B is in the xz plane. F = (-1527-538j +280k) B 650mm z F y A 2300mm 1200mm Answer(s): X
-
For Problem estimate the change in y for the given change in x. y = f(x), f'(12) = 30, x increases from 12 to 12.2
-
The Bahrain Petroleum Company (BAPCO) is considering two mutually exclusive projects. Each requires an initial investment of US$100,000. Faisal AlMahroos, president of the company, has a maximum...
-
Casablanca Paper has the following stockholders' equity account. The firm's common stock has a current market price of US$30 per share. Preferred...
-
P&K Tool is considering lengthening its credit period from 30 to 60 days. All customers will continue to pay on the net date. The firm currently bills US$450,000 for sales and has US$345,000 in...
-
Selected data for Colony Company, which operates three departments, follow: During the year, the companys fixed expenses included the following Assume that the property tax rate is the same for both...
-
The following summary data are from a performance report for Hyland Company for June, during which 9,600 units were produced. The budget reflects the companys normal capacity of 10,000 units. a. What...
-
Terry Enterprises, Inc. has two divisionsthe Foods division and the Clothes division. Historically, Terry has used the divisions ROI as the performance measure for the bonus determinations. Terry...
Study smarter with the SolutionInn App