Question: public static void setBasicAccountData ( BankAccount account ) { account.setAccountID ( getAccountIDFromUser ( ) ) ; account.setInterestRate ( getInterestRateFromUser ( ) ) ; } public

public static void setBasicAccountData(BankAccount account){
account.setAccountID(getAccountIDFromUser());
account.setInterestRate(getInterestRateFromUser());
}
public static void addAccount(){
displayAccountTypeMenu();
int choice = getMenuChoiceFromUser();
handleAccountTypeMenuChoice(choice);
}
public static void addSavingsAccount(){
SavingsAccount newSavings = new SavingsAccount();
setBasicAccountData(newSavings);
accounts.add(newSavings);
}
public static void addCheckingAccount(){
CheckingAccount newChecking = new CheckingAccount();
setBasicAccountData(newChecking);
newChecking.setFee(getOverdraftFeeFromUser());
accounts.add(newChecking);
}
public static void addCreditcardAccount(){
CreditcardAccount newCredit = new CreditcardAccount();
setBasicAccountData(newCredit);
newCredit.setLimit(getCreditLimitFromUser());
accounts.add(newCredit);
}
public static void makeCredit(){
String accountId = getAccountIDFromUser();
int creditAmount = getAmountFromUser();
for (BankAccount curAccount : accounts){
if (accountId.equals(curAccount.getAccountID())){
curAccount.credit(creditAmount);
return;
}
}
System.out.println("*** Credit failed - Invalid account number! ***");
}
public static void makeDebit(){
String accountId = getAccountIDFromUser();
int debitAmount = getAmountFromUser();
for (BankAccount curAccount : accounts){
if (accountId.equals(curAccount.getAccountID())){
if (!curAccount.debit(debitAmount)){
System.out.println("*** Debit failed - Insufficient funds or credit! ***");
}
return;
}
}
System.out.println("*** Debit failed - Invalid account number! ***");
}
public static void transferFunds(){
String srcAccountId = getAccountIDFromUser();
String destAccountId = getAccountIDFromUser();
int transferAmount = getAmountFromUser();
BankAccount srcAccount = null;
BankAccount destAccount = null;
for (BankAccount curAccount : accounts){
if (srcAccountId.equals(curAccount.getAccountID())){
srcAccount = curAccount;
}
if (destAccountId.equals(curAccount.getAccountID())){
destAccount = curAccount;
}
}
if (srcAccount == null || destAccount == null){
System.out.println("*** Transfer failed - Invalid account number! ***");
return;
}
if (srcAccount.debit(transferAmount)){
destAccount.credit(transferAmount);
} else {
System.out.println("*** Transfer failed - Insufficient funds! ***");
}
}
public static void viewAccountDetails(){
String accountId = getAccountIDFromUser();
BankAccount account = findAccountById(accountId);
if (account != null){
System.out.println(account.accountInfo());
} else {
System.out.println("*** Operation failed - Invalid account number! ***");
}
}
public static void applyMonthlyInterest(){
for (BankAccount account : accounts){
account.applyInterest();
}
}
public static BankAccount findAccountById(String accountId){
for (BankAccount curAccount : accounts){
if (accountId.equals(curAccount.getAccountID())){
return curAccount;
}
}
return null;
}
}
1: Structure Test 01
0/4
Main class should have required method named setBasicAccountData
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
2: Structure Test 02
0/4
Main class should have required method named addAccount
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
3: Structure Test 03
0/4
Main class should have required method named addSavingsAccount
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
4: Structure Test 04
0/4
Main class should have required method named addCheckingAccount
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
5: Structure Test 05
0/4
Main class should have required method named addCreditcardAccount
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
6: Structure Test 06
0/4
Main class should have required method named makeCredit
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
7: Structure Test 07
0/4
Main class should have required method named makeDebit
Feedback
FAIL - correct method NOT found
Review the assignment instructions regarding required methods.
8: Structure Test 08
0/4
Main class should have required method named transferFunds
Feedback
FAIL - correct method NOT found
Review the assignment instructio

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!