Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CheckingAccount code public class CheckingAccount extends BankAccount { private int overdraftFee = 0; public boolean debit(int pennies) { balance = balance - pennies; if (balance

CheckingAccount code

public class CheckingAccount extends BankAccount { private int overdraftFee = 0;

public boolean debit(int pennies) { balance = balance - pennies; if (balance

public void setFee(int fee) { overdraftFee = fee; }

public int getFee() { return overdraftFee; }

public void applyInterest() { if (balance > 0) { int interest = (int) Math.floor(balance * interestRate); balance = balance + interest; } }

public String accountInfo() { String info = "Type of Account : Checking "; info += "Account ID : " + accountID + " "; info += "Current Balance : $" + (balance / 100) + "." + (balance % 100) + " "; info += "Interest rate : " + (interestRate * 100) + "% "; info += "Overdraft Fee : $" + overdraftFee / 100 + "." + overdraftFee % 100 + " "; return info; } }

BankAccount code

public abstract class BankAccount { protected String accountID; protected double interestRate; protected int balance; public BankAccount() { accountID = "0000-0000-0000-0000"; interestRate = 0.0; balance = 0; } public boolean credit(int pennies) { balance += pennies; return true; } public abstract boolean debit(int pennies); public int getBalance() { return balance; } public String getAccountID() { return accountID; } public void setAccountID(String accountID) { this.accountID = accountID; } public double getInterestRate() { return interestRate; } public void setInterestRate(double interestRate) { this.interestRate = interestRate; } public abstract void applyInterest(); public abstract String accountInfo(); }

image text in transcribed

Can anyone fix the problem that showing in pic! I have to get interest rate correct to get the points

24:Logic Test 17 0/4 Given a new CheckingAccount(ca), after ca.setFee(1000) and ca.setAccountID("1234-5678-9876-5432") and ca.credit(9876) and ca.setInterestRate(0.123), accountInfo should return a correctly formatted String Test feedback

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions