AP - Comparable and compareTo method Quiz (full period)
AP - Introduction to Polymorphism
Monday 3-8
From Friday
Declare a constant in SavingsAccount for a $10 monthly fee
Declare a constant in CheckingAccount for a $12 monthly fee
Declare a constant in StudentChecking for a $5 monthly fee
Submit the constant declarations for each class.Write a method named chargeMonthlyFee which deducts the monthly fee from the balance for each Class. Submit chargeMonthlyFee for all three classes.
Declare a constant (intRate) in SavingsAccount containing an interest rate of 2.3%.
Write a method (addInterest) to calculate and add the interest to the account.
Submit intRate declaration and addInterest method.Create a new class named InterestCheckingAccount which extends CheckingAccount.
This class will contain a constant containing an interest rate (intRate) of 1.2%. Write the method (addInterest) to calculate and add the interest rate to the balance. Submit the complete InterestCheckingAccount class.Add toString methods to the SavingsAccount, CheckingAccount, and StudentCheckingAccount classes. Submit the toString methods for all three classes.
Add a chargeMonthlyFee to InterestCheckingAccount.
Copy and paste the Amain main method code in your main method. Only change the red code. Submit the main method and output.
All submissions above are due midnight Tuesday but you will not have the class period on Tuesday to work on it.
Static variables
Change your basic fee constant to the following variable
private static double basicFee = 10 ;
Make changes to methods that use this variable (was a constant)
Change your Student fee constant to the following variable
private static double studentFee = 5 ;
Make changes to methods that use this variable (was a constant)
Write an updateBasicFee method (changes the fee)
Write an updateStudentFee method(changes the fee)
Write an accessor for studentFee and basicFee variables.
Change your Saving Account Interest Rate constant to the following variable :
private static double savIntRate=.023;
Write an updateSavIntRate method
Write an accessor the the savings Interest Rate.
Change your Interest Checking Account Interest Rate constant to the following variable:
private static double checkIntRate = .012
Write an updateCheckIntRate method
Write an accessor for the checkIntRate variableChange toString methods to output the following information for the interest accounts :
Initials Balance=<balance> current Interest rate = <current rate> fee charge = <fee charge>
Change toString methods to output the following information for the non interest accounts :
Initials Balance=<balance> fee charge = <fee charge>
Wednesday
Submit the Amain output from Tuesday.
Add the following to the Account class private data
private static String nextAccNum = "1234000";
In Account write
public static String getNewAccountNumber()
Create an Integer object with nextAccNum.
Create a primitive int variable and assign it the intValue from the Integer object plus 1.
assign nextAccNum the int created above.
return the primitive int value.
Sample output for Amain (public static void main code)
My Name is kedigh
Account Balances
1234001 S.B. Balance : $350.0 Current Interest rate : 0.023 Fee Charge : 10.0
1234002 D.P.H. Balance : $700.0 Fee Charge : 10.0
1234003 C.A. Balance : $100.0 Fee Charge : 5.0
1234004 D.H. Balance : $434.0 Fee Charge : 10.0 Current Interest rate : 0.012
Account Balances after Monthly Fees
1234001 S.B. Balance : $340.0 Current Interest rate : 0.023 Fee Charge : 10.0
1234002 D.P.H. Balance : $690.0 Fee Charge : 10.0
1234003 C.A. Balance : $95.0 Fee Charge : 5.0
1234004 D.H. Balance : $424.0 Fee Charge : 10.0 Current Interest rate : 0.012
Account Balances after Interest added
1234001 S.B. Balance : $347.82 Current Interest rate : 0.023 Fee Charge : 10.0
1234002 D.P.H. Balance : $690.0 Fee Charge : 10.0
1234003 C.A. Balance : $95.0 Fee Charge : 5.0
1234004 D.H. Balance : $429.088 Fee Charge : 10.0 Current Interest rate : 0.012
Thursday
Submit the output from wednesday.
Read Lewis 382-404 subclass, superclass, derived class, base class, parent, sibling. more
Abstract Classes and Interfaces
New Project : Chaos
Characters and Weapons (one an interface, one and abstract class)
Friday
Submit and I will reply with the questions missed. Two submissions per question set.
Inheritance True-False
Inheritance Multiple Choice
Inheritance Completion
Inheritance Matching