Question: In Java programming coding Create an Accounts class with the following: 1. three private attributes, - name string, private, customer name - type string, private,
In Java programming coding
Create an Accounts class with the following: 1. three private attributes, - name string, private, customer name - type string, private, type of account (i.e., checking, savings, credit card, etc.) - balance double, private, account balance 2. an overloaded constructor which, - takes in a parameter, of type string, and assigns it to the name attribute - initializes the type attribute to Checking - initializes the balance attribute to zero 3. a getter and setter method for each of the 3 private attributes 4. a method, call it addAmount which, - returns no value - takes in a parameter, of type double, and adds it to the balance attribute 5. a method, call it deductAmount which, - returns no value - takes in a parameter, call it withdrawalAmount, of type double - if the withdrawalAmount is greater than the balance attribute, displays on the screen an insufficient funds message - if the withdrawalAmount is less than the balance attribute, subtracts withdrawalAmount from the balance attribute 6. a method, call it displayBalance which, - returns no value - takes in no parameters - displays the account name, type and balance, with appropriate labels - Note: dollar amounts should display containing only two decimals
Create an AccountsTest class (i.e., driver class) which: 1. creates a method, call it TransactionsMenu which, - takes in no parameters - returns no value - prints the following menu: ************************ 1) Deposit 2) Withdraw 3) Check Balance 4) Exit ************************ 2. creates an account object, with your name as the account owner 3. displays the transaction menu and reads in the user response 4. uses a loop and switch constructs to process the selected transactions as follows: - if the user enters 1: a. prompts the user and reads in a deposit amount b. updates the account balance with the deposit amount c. displays to the screen the account name, type, and balance d. displays to the screen a transaction complete message - if the user enters 2: a. prompts the user and reads in a withdrawal amount b. updates the account balance with the withdrawal amount c. displays to the screen the account name, type, and balance d. displays to the screen a transaction complete message - if the user enters 3: a. displays to the screen the account name, type, and balance b. displays to the screen a transaction complete message - if the user enters 4, terminates the program 5. allows the user to only enter transaction ids of 1, 2, 3, or 4 6. displays an error message if the user enters any integer other than a 1, 2, 3, or 4 (i.e., Error: must enter a 1, 2, 3, or 4. Please try again:) and then allows the user to reenter a valid integer 7. allows the user to process an unlimited number of transactions until 4 is entered to terminate the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
