Question: Abstract Class BankDataBase List allAccounts BankDataBase(){ populateAccountData() } Function getAccountLength{ Pass In: None Pass Out: allAccounts.length() } Function getAccountList{ Pass In: None Pass Out: allAccounts
Abstract Class BankDataBase
List
BankDataBase(){
populateAccountData()
}
Function getAccountLength{
Pass In: None
Pass Out: allAccounts.length()
}
Function getAccountList{
Pass In: None
Pass Out: allAccounts
}
Function populateAccountData{
Pass In: None
allAccounts = FetchDataFromDataBase()
Pass Out:None
}
Function saveAccount{
Pass In: String userName, String password
allAccounts.add(Pass In: NetAccount(Pass In: userName, password))
}
End
Class NetBankAccounts:
BankDataBase bankDatabase
Bank{
Pass In: String userName, password
bankDatabase = new BankDataBase()
}
bool VerifyAccount{
IF( bankDatabase.getAccountList().contains(userName) ){
Pass Out: true
}
ELSE{
Pass Out: false
}
}
Bank{ }
Function getAccountAmountDetails{
Pass In: None
IF(VerifyAccount()==true){
FOR (Integer i = 0 ; i < bankDatabase.getAccountLength() ; i++){
IF (bankDatabase.allAccounts[i].userName==this.userName){
Pass Out: bankDatabase.allAccounts[i].amount
}
ELSE{
Pass Out: "Exception Occured"
}
}
}
ELSE{
Pass Out: "No Account Found"
}
}
Function CreateAccount{
Pass Out: bankDatabase.saveAccount()
}
End
Class NetAccount extend NetBankAccounts:
String userName
String password
Long amount
NetAccount{
Pass In: String userName, String password
super(Pass In: userName, password)
this.userName = userName
this.password = password
this.amount = super.getAccountAmountDetails()
}
NetAccount{}
Function isAccountHolder{
Pass In: None
IF(super.VerifyAccount()==true){
Pass Out: true
}
ELSE{
Pass Out: false
}
}
Function getUserName{
Pass Out: userName
}
Function getUserPassword{
Pass Out: password
}
Function getBalance{
Pass Out: amount
}
Function createAccount{
IF(!isAccountHolder == true){
super.CreateAccount(Pass In: userName, password)
Pass Out: true;
}
ELSE{
Pass Out: false;
}
}
Function isAmountAvailable{
Pass In: Long amount
IF (getBalance()>=amount){
Pass Out: true
}
ELSE{
Pass Out false
}
}
Function deductMoney{
Pass In: long deductedMoney
this.amount = this.amount - deductMoney
}
Function sendMoney{
Pass In: long sendAmount , String receiverUsername
IF(isAmountAvailable(sendAmount)){
IF(NetAccount(Pass In: receiverAccountUsername).isAccountHolder() == true){
NetAccount(Pass In: receiverAccountUsername).amount += sendAmount
}
}
ELSE{
PRINT: "Receiver does not exists"
}
}
Function depositMoney{
Pass In: amountToDeposite
this.amount = this.amount + amountToDeposite
}
Main
String mainOptions
NetAccount userAccount;
String userName
String password
While(true){
PRINT: "Welcome To Net Banking Application"
PRINT: "A: Register Account"
PRINT: "B: Log In"
PRINT: "C: Exit"
Input: mainOptions
switch(mainOptions):
case "A" : {
PRINT: "Enter Username: "
Input: userName
PRINT: "Enter Password: "
Input: password
userAccount = NetAccount(userName, password)
IF(userAccount.CreateAccount()==true){
PRINT: "Account Created Successfully"
}
ELSE{
PRINT: "Account Already Exists"
}
} Break
case "B" : {
PRINT: "Enter Username: "
Input: userName
PRINT: "Enter Password: "
Input: password
userAccount = NetAccount(Pass In: userName, password)
IF(userAccount.isAccountHolder()== true){
PRINT: "Welcome To Net Banking"
ViewMenu(Pass In: userAccount);
}
ELSE{
bool startLoop = true
while(startLoop==true){
Integer Option
PRINT: "Invalid Credentails"
PRINT: "A: Try Again"
PRINT: "B: Go Back To Main Menu"
Input: option
IF(option == "A"){
continue
}
ELSE{
startLoop = false
}
}
}
} Break
case "C" : Exit
}
End
Class BankTransactions
NetAccount userAccount
BankTransactions{
Pass In: NetAccount userAccount
this.userAccount = userAccount
}
Function withdrawMoney{
Pass In: long amount
IF(userAccount.isAmountAvailable(amount) = true){
userAccount.deductMoney(Pass In: amount)
Pass Out: true;
}
Else{
Pass Out: false
}
}
Function transfer{
Pass In: long amount, long receiverAccountUsername
Pass Out: userAccount.sendMoney(Pass In: amount, receiverAccountUsername)
}
Function deposit{
Pass In: long amount
Pass Out: userAccount.depositMoney(Pass In: amount)
}
End
Class NetWithdraw inherit BankTransactions
NetWithdraw(){
Pass In: NetAccount userAccount
Parent(Pass In: userAccount)
}
End
Class NetTransfer inherit BankTransactions
NetTransfer(){
Pass In: NetAccount userAccount
Parent(Pass In: userAccount)
}
End
Class NetDeposit inherit BankTransactions
NetDeposit(){
Pass In: NetAccount userAccount, Long amount
Parent(Pass In: userAccount,amount)
}
End
Function ViewMenue(NetAccount userAccount){
Integer amount
String username
NetTransfer accountTransferObj;
NetWithdraw accountWithdrawObj;
NetDeposit accountDepositObj;
String option = "x"
while(option != "E"){
PRINT: "A: Check Balance"
PRINT: "B: Transfer Balance"
PRINT: "C: Profile Information"
PRINT: "D: Deposit Money"
PRINT: "E: Withdraw Money"
PRINT: "F: Log Out"
switch(option){
case "A":{
PRINT: "User: " & userAccount.userName & " has " & userAccount.getBalance() " Balance"
}Break
case "B":{
PRINT: "Enter amount to be transfered: "
Input: amount
PRINT: "Enter receiver account username: "
Input: receiverUserName
accountTransferObj = NetTransfer(userAccount)
IF(accountTransferObj.transfer(receiverAccountUsername, amount)){
PRINT: "Amount is Tranfered To Receiver: " & receiverUserName
}
ELSE{
PRINT: "Receiver does not exists"
}
}Break
case "C":{
PRINT: "Profile Information: "
PRINT: "User name: " userAccount.getUserName()
PRINT: "Password: " userAccount.getUserPassword()
PRINT: "Balance: " userAccount.getBalance()
}Break
case "D":{
PRINT: "Enter amount to be Deposited: "
Input: amount
accountDepositObj = NetDeposit(userAccount)
IF(accountDepositObj.deposit(amount)){
PRINT: "Amount Depositted successfully: "
PRINT: "Current Balance is: " & userAccount.getBalance()
}
ELSE{
PRINT: "Network Error"
}
}Break
case "E":{
PRINT: "Enter amount to be withdrawn: "
INPUT: amount
accountWithdrawObj = NetWithdraw(userAccount)
IF(accountWithdrawObj.withdrawMoney(amount)){
PRINT: "Amount withdrawn successfully: "
PRINT: "Current Balance is: " & userAccount.getBalance()
}
ELSE{
PRINT: "Insufficient Balance"
}
}Break
case "F": Break
}
}
}
Turn the pseudocode into a java project.
The app must meet the following requirements:
- be object oriented(multiple classes, getter and setter methods, create objects)
- include user input
- output to a console
- involve decision making
- utilize iteration
- employ array(s)
- provide an effective interface
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
