BankCharges

BankCharges - @param c The number of checks written. */...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** BankCharges Class Chapter 6, Programming Challenge 8 */ public class BankCharges { private final double BASE_FEE = 10.0; // Base monthly fee private final double LOW_BALANCE = 400.0; // Low balance threshold private final double LOW_BALANCE_FEE = 15.0; // Fee for low balance //step1: declare two fields private double balance; private int numberOfChecks; double fees; /* step2: The constructor accepts two parameters,one initializes the object with a beginning balance, the other intializes the number of checks written. */ public BankCharges(double b, int checks) { balance = b; numberOfChecks = checks; } /* step3: The constructor accepts one parameter for initializing the object with a beginning balance, at the same time, initialize and number of checks to be 0 */ public BankCharges(double b) { balance = b; numberOfChecks = 0; } /* step4: The setChecksWritten method accepts a parameter for setting the number of checks written for a month.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: @param c The number of checks written. */ public void setChecksWritten(int checks) { numberOfChecks = checks; } /* step5: mutator method for balance */ public void setBalance(double b) { balance = b; } /* step7: accessor method for balance */ public double getBalance() { return balance; } /* step8: accessor method for checks written method */ public int getChecksWritten() { return numberOfChecks; } /* step9: The getFees method returns the amount of monthly fees for the account. */ public double getFees() { double fees = 0; if (numberOfChecks <20) { fees = 10 + 0.1*numberOfChecks; } else if (numberOfChecks >=20 && numberOfChecks <=39) { fees = 10 + 0.08*numberOfChecks; } else if (numberOfChecks >=40 && numberOfChecks<=59) { fees = 10 + 0.06*numberOfChecks; } else if (numberOfChecks >=60) { fees = 10 + 0.04*numberOfChecks; } return fees; } }...
View Full Document

Page1 / 2

BankCharges - @param c The number of checks written. */...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online