Programming help! Account info

User Generated

frzvabyrf2015

Programming

Description

Hello!

We have to write a Java Program to implement a solution using the algorithm, which uses a do-while loop and functions. 

Unformatted Attachment Preview

Lesson 8 Assignment #8: “BankAccount.java” Assignment Submission Due Date: Monday, July 27, 2015 by 11:59pm Total Lesson Assignment Points: 80 [Refer to Grading Rubric] Total Extra Credit Points: 8 [Refer to Grading Rubric] Submission Requirements: • Submit the word document (Assignment #8 Submission Form) to the Assignment #8 submission link on Blackboard completing the following section: o Test Scenarios (20 - Lesson Assignment Points)  Describe TWO test scenarios used to verify the correctness of the program. (Use template provided!) o Test Scenarios (+8 Extra Credit Points)  Describe TWO additional test scenarios used to verify the correctness of the program. (Use template provided!) • Submit the program [.java file] to the same Assignment #8 submission link on Blackboard o Write the following program:  “BankAccount.java” using the algorithm below. (60 – Lesson Assignment Pts) ****The “BankAccount.java” file is available to help you get started. You are free to add your code to this file!**** Program Description: A module or function is suitable when you have a series of highly cohesive statements that can be used in more than one place in a program. In a menu with several items, a module or function can be useful for the lines of code to display the menu and get the user’s choice. Using the same bank account program from Assignment #7, this assignment uses modules and functions to design a menu system applying the top-down method of program design. Like all modular program development, developing a menu system this way keeps the control section (the menu itself) separated from the content section (the modules), making it easier to develop and improve both sections. 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 AND functions. The user will be presented the menu until the user selects the option to exit the application. Write a program entitled “BankAccount.java” using the following algorithm: +++++++++++++++++++++++++++++++++++++++++ BankAccount.java Class ++++++++++++++++++++++++++++++++++++++++++++ //Declaration and Initialization of Global Variable //This variable is accessible to ALL functions (SCOPE) to update Declare and initialize Global variable - current balance [HINT: Assume that the initial balance for all customers is: 5000.00] ++++++++++++++++++++++++++++++++++++++++++++ main() Function +++++++++++++++++++++++++++++++++++++++++++++++++++++ //Declaration(s) variable(s) Declare a Scanner object //HINT: Other variable declarations may be needed!!! //Display the welcome message - (The 'Boss' does NOT need a value returned!) //HINT: The 'Boss' does NOT need a value returned. Call the welecomeMessage() function //Prompt the user to enter the account number //HINT: The 'Boss' needs the account number returned! Assign the call statement to a variable. Call the accountInfo() function //Process menu using a Do-While loop and Switch statement //This will Display the menu and Call the Function(s) based on the user's choice until the user enters X Do //Call the menuSelection function to display the menu and ask the user for their choice //HINT: The 'Boss' needs the choice returned! Assign the call statement to a variable. Call the displayMenu() function //Switch statement is used to determine which function is called based on the user’s choice //Each case represents the ‘Boss’ calling a function or the ‘Helper’ to perform some task Switch (the menu choice selected) Case (If the menu choice is “D”) //The ‘Boss’ calls this function or ‘Helper’ to ask the user for deposit amount and update balance //HINT: The ‘Boss’ needs the current balance returned! Assign the call statement to a variable. //HINT: The ‘Helper’ needs the current balance to perform its tasks. Call the depositTransaction( current balance) function and assign it to a variable Break Case (If the menu choice is “W”) //The ‘Boss’ calls this function or ‘Helper’ to ask the user for withdrawal amount and update balance //HINT: The ‘Boss’ needs the current balance returned! Assign the call statement to a variable. //HINT: The ‘Helper’ needs the current balance to perform its tasks. Call the withdrawalTransaction(current balance) function and assign it to a variable Break Case (If the menu choice is “B”) //The ‘Boss’ calls this function or ‘Helper’ to display the account number and current balance //HINT: The ‘Boss’ does NOT need a value returned! //HINT: The ‘Helper’ needs the current balance and the account number to perform its tasks. Call the checkBalance(account number, current balance) function Break //This branch causes the loop to stop and the menu will no longer be displayed Case (If the menu choice is “X”) Break //This branch is responsible for handling all invalid choices entered by the user Default If not D, W, B, or X, 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!” +++++++++++++++++++++++++++++++++++++++ end of main() Function Definition ++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++ welcomeMessage() Function Definition ++++++++++++++++++++++++++++++++++++++++++ //Display welcome message Display welcome message “Welcome to Seminole Bank!” ++++++++++++++++++++++++++++++++++++ end of welcomeMessage() Function Definition +++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++ accountInfo() Function Definition +++++++++++++++++++++++++++++++++++++++++++++ //Prompt and Read users’ account number // RETURN the account number to the “BOSS” Display “Please enter your 5-digit Account Number: ” Read user’s account number Display “Thank you!!” Return the user’s account number (to the BOSS) ++++++++++++++++++++++++++++++++++++++ end of accountInfo() Function Definition ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++ displayMenu() Function Definition +++++++++++++++++++++++++++++++++++++++++++++ //Display menu choices to the user and Read the users’ banking choice // RETURN the user’s menu choice to the “BOSS” 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)] Return menu choice (to the BOSS) +++++++++++++++++++++++++++++++++++++ end of displayMenu() Function Definition +++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++ depositTransaction() Function Definition +++++++++++++++++++++++++++++++++++++++++++ //Prompt the user for the amount to deposit and Read deposit amount //Update the current balance and RETURN the current balance to the “BOSS” Display “Enter the amount of the deposit: “ Read the deposit amount Calculate the current balance after the deposit [HINT: current balance = current balance + deposit amount] Return current balance (to the BOSS) ++++++++++++++++++++++++++++++++++ end of depositTransaction() Function Definition +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++ withdrawalTransaction() Function Definition ++++++++++++++++++++++++++++++++++++++++ //Prompt the user for the amount to withdraw and Read withdrawal amount //Update the current balance and RETURN the current balance to the “BOSS” Display “Enter the amount of the withdrawal: “ Read the withdrawal amount Calculate the current balance after the withdrawal [HINT: current balance = current balance - withdrawal amount] Return current balance (to the BOSS) +++++++++++++++++++++++++++++++ end of withdrawalTransaction() Function Definition +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++ checkBalance() Function Definition ++++++++++++++++++++++++++++++++++++++++++++++++ //Display the current balance and DO NOT RETURN anything to the “BOSS” Display “Account Number: “ (INSERT THE ACCOUNT NUMBER) “ has a current balance of : $ “ current balance +++++++++++++++++++++++++++++++ end of checkBalance() Function Definition +++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++ END OF BankAccount.java Class ++++++++++++++++++++++++++++++++++++++++++++ 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); Scenario Test Focus: Scenario Information: Expected Results: • Testing the deposit function to ensure that the current balance is updated followed by a withdrawal transaction. • Verify that the application will accept lower and upper case menu item choices. Account Number: 12546 Menu Item Choice: B (upper case) [Balance: $5000.00 - initial balance] Menu Item Choice: d (lower case) [Deposit: 5000] Menu Item Choice: W (upper case) [Withdraw: 1000.00] Menu Item Choice: b (lower case) [Balance: $9000.00] Menu Item Choice: x (lower case) Current balance should be: $9000.00 Student Name: __________________ Assignment #8: Submission Form Submission Date: ________________ A. Test Scenarios. [20 Lesson Assignment Points] (Describe TWO test scenarios used to verify the correctness of the program by filling in the blank Test Scenario tables below.) HINT: Look at the “Test Scenarios and Sample Runs” above for guidance!!! Test Scenario Template: Scenario Test Focus: What this scenario is testing – refer to example testing scenario and sample run above Scenario Information: Inputs Expected Results: Expected outcomes Test Scenario #1: Scenario Test Focus: Scenario Information: Expected Results: Test Scenario #2: Scenario Test Focus: Scenario Information: Expected Results: B. Write and Run the Program. [60 Lesson Assignment Points] (Write the Java Program to implement a solution using the algorithm above, which uses a do-while loop and functions.) Program Name: BankAccount.java Test Scenario #3: (+4 Extra Credit Points) Scenario Test Focus: Scenario Information: Expected Results: Test Scenario #4: (+4 Extra Credit Points) Scenario Test Focus: Scenario Information: Expected Results:
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 study resource, helped me a lot.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4