Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this project, you are asked to implement a Java program that controls bank accounts for a certain bank. The accounts should be stored in
In this project, you are asked to implement a Java program that controls bank accounts for a certain bank. The accounts should be stored in a data structure that facilitates a set of operations. The operations will be performed based on the selection of the user interactive menudriven system The program starts by displaying a menu that allows the user to perform the following operations:
Add a new account. The user will be asked to enter the information of the account including ID account type, initial balance, and the name of the owner. The account will be active by default.
Change Owner name of a specific account ID should be provided followed by the new Owner name
Change Balance of a specific account ID should be provided followed by the new balance
Change Type of a specific account ID should be provided followed by if the new type is Salary, or is the new type is Surprise
Activate a specific account ID should be provided
Deactivate a specific account ID should be provided
Withdraw from a specific account ID should be provided followed by the amount to be withdrawn
Deposit to a specific account ID should be provided followed by the amount to be deposited
Delete an account ID should be provided
Display number of chances to win ID should be provided
Display all information of a specific account ID should be provided
Display the information of all the accounts sorted in an increasing order according to the account's ID
Exit the program.
You are asked to implement this project with at least two different implementations. In each implementation, you have to use a different data structure for storing the accounts in order to facilitate the operation we need to perform on the accounts. Furthermore, the change methods typed in bold should have an average complexity of in at least one of
the implementations.
Note that, first you need to implement class Account that represents a bank account. The class contains the following members:
An int data field ID that represents the ID of a bank account.
A char data field type that specifies the type of the bank account. Note that the bank offers two types of accounts: S for Salary account, or P for Surprise account. The type can never have a third value.
A double data field balance that represents the current balance in the bank account. The balance can never be less than
A String data field owner that represents the name of the owner of the bank account.
A boolean data field active that specifies whether the bank account is activated or deactivated. Note that a true value means that the account is activated. Otherwise, it is deactivated.
A constructor that accepts four arguments ID type, balance, owner and creates a bank account object in which the status of active data member is true by default.
Accessor and mutator methods for all data fields.
A void method withdraw that receives one parameter amount and withdraws the amount from the current balance of the account. Note that you can only withdraw from an active account that has a current balance which at least equals to the amount to be withdrawn. The method should display a message whether the operation has been performed successfully or not.
A void method deposit that receives one parameter amount and deposits the amount to the current balance of the account. Note that you can only deposit to an active account. The method should display a message whether the operation has been performed successfully or not.
A toString method which converts all the data of Account into a well formatted string.
An int method chances that returns the number of chances to enter a draw for a bank surprise. Note that, this option is only available for Surprise accounts. Otherwise, the method should return Also note that the customer will have one chance to enter a draw for each eg if the customer current balance is then he will have chances to enter a draw
A compareTo method which compares between objects of class Account according to their IDs.
After the completion of both implementations, you need to submit the following:
A report that includes the following A template will be provided:
a Cover page
b Table of contents
c Data structures This section presents the data structure used in each implementation. It should include the reason for choosing each data structure to address the given problem plus the advantages and disadvantages of the data structure in the problem context. Then, state which data structure is most appropriate for the given problem and why?
d Code of first implementation
e Code of second implementation
f Change methods algorithm This section should illustrate the techniques that you will use to implement the change method described in the project requirements to have an average complexity of n
full java code using netbeans and write implementations with explanation of the code
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