Question
Hello my dear Colud you please help me in this question please *Please when you solve use do while loop* __________________ *Account* package sa.edu.yuc; import
Hello my dear Colud you please help me in this question please
*Please when you solve use do while loop*
__________________
*Account*
package sa.edu.yuc; import java.util.Scanner; public class Account implements Comparable
________________________
*ArrayDuplicateException*
package sa.edu.yuc;
public class ArrayDuplicateException extends Exception { public ArrayDuplicateException(String message) { super(message); } }
_______________________
*ArrayEmptyException*
package sa.edu.yuc; public class ArrayEmptyException extends Exception { public ArrayEmptyException(String message){ super(message); } }
________________________
*ArrayFullException*
package sa.edu.yuc; public class ArrayFullException extends Exception{ public ArrayFullException(String message) { super(message); } } ________
*Bank*
package sa.edu.yuc; public class Bank { public boolean addAccount(Account account) throws ArrayFullException, ArrayDuplicateException { // TODO Auto-generated method stub return false; } public Account findAccount(int id) throws ArrayEmptyException { // TODO Auto-generated method stub return null; } public boolean deleteAccount(int id)throws ArrayEmptyException { // TODO Auto-generated method stub return false; } public void showAll() { // TODO Auto-generated method stub } }
__________________
*BankTest*
package sa.edu.yuc; import java.util.Scanner; public class BankTest { public static void main(String[] args) { Bank bank = new Bank(); Scanner input = new Scanner(System.in); int option; do{ menu(); System.out.print("Enter Option(1..5) > "); option = input.nextInt(); switch (option) { case 1: // TODO Auto-generated method stub break; case 2: // TODO Auto-generated method stub break; case 3: // TODO Auto-generated method stub break; case 4: // TODO Auto-generated method stub break; case 5: System.out.println("Thank you for using bank application !!!"); break; default: System.out.println("Invalid option Plz enter(1..5)!!!"); } }while(option != 5); } private static void menu() { System.out.println("Welcome to MyBank"); System.out.println("Press 1 to add an account"); System.out.println("Press 2 to find an account"); System.out.println("Press 3 to delete an account"); System.out.println("Press 4 to list all accounts"); System.out.println("Press 5 to exit"); } }
_____________
*MyArray*
package sa.edu.yuc; public interface MyArray { public boolean isEmpty(); public boolean isFull(); public boolean add(int value) throws ArrayFullException, ArrayDuplicateException; public boolean remove(int value) throws ArrayEmptyException; public int find(int value) throws ArrayEmptyException; public int get(int index); }
_______________________
*MyArrayImpl*
package sa.edu.yuc; public interface MyArray { public boolean isEmpty(); public boolean isFull(); public boolean add(int value) throws ArrayFullException, ArrayDuplicateException; public boolean remove(int value) throws ArrayEmptyException; public int find(int value) throws ArrayEmptyException; public int get(int index); }
Q.1: Write a program which will allow the user following functionality. Add a new account Find an account Delete an account List all accounts User could be shown following menu. Press 5 to quit 1 - To add a new account 2 - Find an account by account Id 3 - Delete an account by account Id 4 - List all accounts On selecting 1, user should be asked for all the attribute values of the account On selecting 2, user should be asked for the account Id. Search should be performed accordingly. On selecting 3, user should be asked for the account ld. Delete should be performed accordingly. On selecting 4, user should be shown all the accounts with the details. Output: Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 1 Enter Account Information :: Id: 100 Name: rrr Balance: 5689 Done Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 1 Enter Account Information :: Id: 89 Name : uuu Balance: 9089 Done Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 1 Enter Account Information :: Id: 150 Name: ddd Balance: 7654 Done Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 1 Enter Account Information :: Id: 95 Name: ggg Balance: 5643 Done Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 4 Account [id=89, name=uuu, balance=9089.0] Account [id=95, name=ggg, balance=5643.0] Account [id=100, name=rrr, balance=5689.0] Account [id=150, name=ddd, balance=7654.01 Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 2 Enter id to search = 95 Account [id=95, name=ggg, balance=5643.0] Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 2 Enter id to search = 900 Invalid Account ID Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 3 Enter id to search = 100 Account is deleted Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 4 Account [id=89, name=uuu, balance=9089.0] Account [id=95, name=ggg, balance=5643.0] Account [id=150, name=ddd, balance=7654.01 Welcome to MyBank Press 1 to add an account Press 2 to find an account Press 3 to delete an account Press 4 to list all accounts Press 5 to exit Enter Option (1..5) > 5 Thank you for using bank application
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started