Programming help! while and do-while loops

User Generated

frzvabyrf2015

Programming

Description

Hello again! Could you help me out with my assignment? We have to write a two part program, one using the "while" loop and the other using "do-while" loop. Could you help me out?? I would really appreciate it! 

Attached is what she provided us with

Lesson7.pdf 

Unformatted Attachment Preview

Lesson 7 Assignment #7 Assignment Submission Due Date: Monday, July 20, 2015 by 11:59pm Total Lesson Assignment Points: 60 [Refer to Grading Rubric] Total Participation Assignment Points: 25 [Refer to Grading Rubric] Submission Requirements: Submit the word document (Assignment #7 Submission Form) to the Assignment #7 submission link on Blackboard completing the following section: o Test Scenarios (10 - Lesson Assignment Points) Describe at least two or more test scenarios used to verify the correctness of the program. Submit the program [.java file] to the same Assignment #7 submission link on Blackboard o Write the following program: Write “SeminoleBank_A.java” using a while loop. (50 - Lesson Assignment Pts) Submit the program [.java file] to the same Assignment #7 submission link on Blackboard o Write the following program: Write “SeminoleBank_B.java” using a do-while loop. (25 - Participation Assignment Pts) Program Description: An application that involves a menu system limits the choices a user can make so that only valid options are processed. The simplest menu system displays a number of user choices and processes the one the user selects. If the user is expected to make only one choice and then quit, a selection structure can be used. The most common model is a menu that stays onscreen to use repeatedly, instead of a menu that allows users to make only one choice. To create a menu that’s used more than once, a repetition structure that encloses the selection structure is more suitable, where you add a choice for the user to exit the menu. As a form of data validation, you should display an error message if the user doesn’t enter a valid choice (including the exit choice). Given the following algorithm (see following pages), write a program that displays a menu prompting the user to choose their banking option. The algorithm uses a repetition structure. The user will be presented the menu until the user selects the option to exit the application. You are required to write the program using the following: while loop – “SeminoleBank_A.java” do-while loop – “SeminoleBank_B.java” //Declarations and Initializations of variables Declare and initialize deposit Declare and initialize withdrawal Declare and initialize current balance [HINT: Assume that the initial balance for all customers is: 5000.00] [HINT: Other variables may be needed!!!] //Display welcome messages and Request and Read users’ account number Display welcome message “Seminole Bank” Display welcome message “Welcome to Seminole Bank!” Display “Please enter your 5-digit Account Number: ” Read user’s account number Display “Thank you!!” //Display menu choices and Request and Read the users’ banking choice Display “Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: “ Read the user’s menu choice Ensure user input has correct case [HINT: menu choice = Character.toUpperCase(menu choice)] //Process menu until user enters X (Use a WHILE loop with an “if…else if” or a “switch”) While the menu choice is not “X” If the menu choice is “D”, Display “Enter the amount of the deposit: “ Read the deposit amount Calculate the current balance after the deposit [current balance = current balance + deposit amount] Else If the menu choice is “W”, Display “Enter the amount of the withdrawal: “ Read the withdrawal amount Calculate the current balance after the withdrawal [current balance = current balance + withdrawal amount] Else If the menu choice is “B”, Display “Account Number: “ (INSERT THE ACCOUNT NUMBER) “ has a current balance of : $ “ current balance Else Display “ERROR: Please enter a D, W, B, or X: “ //Display menu choices and Request and Read the users’ banking choice Display “Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: “ Read the user’s menu choice Ensure user input has correct case [HINT: menu choice = Character.toUpperCase(menu choice)] End Loop //Display final message Display “Thank you for being a loyal Seminole Bank customer!” HINTS: Hint #1: The program should allow the user to type in the choices using any case. In order to account for user input, consider the following example: o menu choice = Character.toUpperCase(menu choice) Hint #2: Assume that the initial balance for all customers is: $5000.00 Hint #3: All dollar amounts should display two digits after the decimal place. Consider the following example: o System.out.printf("……..%.2f…..", dollar amounts); //Declarations and Initializations of variables Declare and initialize deposit Declare and initialize withdrawal Declare and initialize current balance [HINT: Assume that the initial balance for all customers is: 5000.00] [HINT: Other variables may be needed!!!] //Display welcome messages and Request and Read users’ account number Display welcome message “Seminole Bank” Display welcome message “Welcome to Seminole Bank!” Display “Please enter your 5-digit Account Number: ” Read user’s account number Display “Thank you!!” //Process menu until user enters X (Use a DO-WHILE loop with an “if…else if” or a “switch”) Do //Display menu choices and Request and Read the users’ banking choice Display “Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: “ Read the user’s menu choice Ensure user input has correct case [HINT: menu choice = Character.toUpperCase(menu choice)] If the menu choice is “D”, Display “Enter the amount of the deposit: “ Read the deposit amount Calculate the current balance after the deposit [current balance = current balance + deposit amount] Else If the menu choice is “W”, Display “Enter the amount of the withdrawal: “ Read the withdrawal amount Calculate the current balance after the withdrawal [current balance = current balance + withdrawal amount] Else If the menu choice is “B”, Display “Account Number: “ (INSERT THE ACCOUNT NUMBER) “ has a current balance of : $ “ current balance Else if menu choice does not equal “X” then Display “ERROR: Please enter a D, W, B, or X: “ While the menu choice is not “X” //Display final message Display “Thank you for being a loyal Seminole Bank customer!” HINTS: Hint #1: The program should allow the user to type in the choices using any case. In order to account for user input, consider the following example: o menu choice = Character.toUpperCase(menu choice) Hint #2: Assume that the initial balance for all customers is: $5000.00 Hint #3: All dollar amounts should display two digits after the decimal place. Consider the following example: o System.out.printf("……..%.2f…..", dollar amounts); Assignment #7: Submission Form Student Name: __________________ Submission Date: ________________ A. Test Scenarios. [10 Lesson Assignment Points] (Describe at least two or more test scenarios used to verify the correctness of the program.) HINT: Look at the “Sample Runs” provided!!! B. Write and Run the Program. [50 Lesson Assignment Points] (Write the Java Program to implement a solution using a while loop.) Program Name: SeminoleBank_A.java C. Write and Run the Program. [25 Participation Assignment Points] (Write the Java Program to implement a solution using a do-while loop.) Program Name: SeminoleBank_B.java Lesson 7 Assignment #7 Assignment Submission Due Date: Monday, July 20, 2015 by 11:59pm Total Lesson Assignment Points: 60 [Refer to Grading Rubric] Total Participation Assignment Points: 25 [Refer to Grading Rubric] Submission Requirements: Submit the word document (Assignment #7 Submission Form) to the Assignment #7 submission link on Blackboard completing the following section: o Test Scenarios (10 - Lesson Assignment Points) Describe at least two or more test scenarios used to verify the correctness of the program. Submit the program [.java file] to the same Assignment #7 submission link on Blackboard o Write the following program: Write “SeminoleBank_A.java” using a while loop. (50 - Lesson Assignment Pts) Submit the program [.java file] to the same Assignment #7 submission link on Blackboard o Write the following program: Write “SeminoleBank_B.java” using a do-while loop. (25 - Participation Assignment Pts) Program Description: An application that involves a menu system limits the choices a user can make so that only valid options are processed. The simplest menu system displays a number of user choices and processes the one the user selects. If the user is expected to make only one choice and then quit, a selection structure can be used. The most common model is a menu that stays onscreen to use repeatedly, instead of a menu that allows users to make only one choice. To create a menu that’s used more than once, a repetition structure that encloses the selection structure is more suitable, where you add a choice for the user to exit the menu. As a form of data validation, you should display an error message if the user doesn’t enter a valid choice (including the exit choice). Given the following algorithm (see following pages), write a program that displays a menu prompting the user to choose their banking option. The algorithm uses a repetition structure. The user will be presented the menu until the user selects the option to exit the application. You are required to write the program using the following: while loop – “SeminoleBank_A.java” do-while loop – “SeminoleBank_B.java” //Declarations and Initializations of variables Declare and initialize deposit Declare and initialize withdrawal Declare and initialize current balance [HINT: Assume that the initial balance for all customers is: 5000.00] [HINT: Other variables may be needed!!!] //Display welcome messages and Request and Read users’ account number Display welcome message “Seminole Bank” Display welcome message “Welcome to Seminole Bank!” Display “Please enter your 5-digit Account Number: ” Read user’s account number Display “Thank you!!” //Display menu choices and Request and Read the users’ banking choice Display “Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: “ Read the user’s menu choice Ensure user input has correct case [HINT: menu choice = Character.toUpperCase(menu choice)] //Process menu until user enters X (Use a WHILE loop with an “if…else if” or a “switch”) While the menu choice is not “X” If the menu choice is “D”, Display “Enter the amount of the deposit: “ Read the deposit amount Calculate the current balance after the deposit [current balance = current balance + deposit amount] Else If the menu choice is “W”, Display “Enter the amount of the withdrawal: “ Read the withdrawal amount Calculate the current balance after the withdrawal [current balance = current balance + withdrawal amount] Else If the menu choice is “B”, Display “Account Number: “ (INSERT THE ACCOUNT NUMBER) “ has a current balance of : $ “ current balance Else Display “ERROR: Please enter a D, W, B, or X: “ //Display menu choices and Request and Read the users’ banking choice Display “Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: “ Read the user’s menu choice Ensure user input has correct case [HINT: menu choice = Character.toUpperCase(menu choice)] End Loop //Display final message Display “Thank you for being a loyal Seminole Bank customer!” HINTS: Hint #1: The program should allow the user to type in the choices using any case. In order to account for user input, consider the following example: o menu choice = Character.toUpperCase(menu choice) Hint #2: Assume that the initial balance for all customers is: $5000.00 Hint #3: All dollar amounts should display two digits after the decimal place. Consider the following example: o System.out.printf("……..%.2f…..", dollar amounts); //Declarations and Initializations of variables Declare and initialize deposit Declare and initialize withdrawal Declare and initialize current balance [HINT: Assume that the initial balance for all customers is: 5000.00] [HINT: Other variables may be needed!!!] //Display welcome messages and Request and Read users’ account number Display welcome message “Seminole Bank” Display welcome message “Welcome to Seminole Bank!” Display “Please enter your 5-digit Account Number: ” Read user’s account number Display “Thank you!!” //Process menu until user enters X (Use a DO-WHILE loop with an “if…else if” or a “switch”) Do //Display menu choices and Request and Read the users’ banking choice Display “Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: “ Read the user’s menu choice Ensure user input has correct case [HINT: menu choice = Character.toUpperCase(menu choice)] If the menu choice is “D”, Display “Enter the amount of the deposit: “ Read the deposit amount Calculate the current balance after the deposit [current balance = current balance + deposit amount] Else If the menu choice is “W”, Display “Enter the amount of the withdrawal: “ Read the withdrawal amount Calculate the current balance after the withdrawal [current balance = current balance + withdrawal amount] Else If the menu choice is “B”, Display “Account Number: “ (INSERT THE ACCOUNT NUMBER) “ has a current balance of : $ “ current balance Else if menu choice does not equal “X” then Display “ERROR: Please enter a D, W, B, or X: “ While the menu choice is not “X” //Display final message Display “Thank you for being a loyal Seminole Bank customer!” HINTS: Hint #1: The program should allow the user to type in the choices using any case. In order to account for user input, consider the following example: o menu choice = Character.toUpperCase(menu choice) Hint #2: Assume that the initial balance for all customers is: $5000.00 Hint #3: All dollar amounts should display two digits after the decimal place. Consider the following example: o System.out.printf("……..%.2f…..", dollar amounts); Assignment #7: Submission Form Student Name: __________________ Submission Date: ________________ A. Test Scenarios. [10 Lesson Assignment Points] (Describe at least two or more test scenarios used to verify the correctness of the program.) HINT: Look at the “Sample Runs” provided!!! B. Write and Run the Program. [50 Lesson Assignment Points] (Write the Java Program to implement a solution using a while loop.) Program Name: SeminoleBank_A.java C. Write and Run the Program. [25 Participation Assignment Points] (Write the Java Program to implement a solution using a do-while loop.) Program Name: SeminoleBank_B.java
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Anonymous
Great! 10/10 would recommend using Studypool to help you study.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags