Question
Your program will prompt users for options such as creating an initial balance, entering deposits or withdrawals. Also your program will allow for the printing
Your program will prompt users for options such as creating an initial balance, entering deposits or withdrawals. Also your program will allow for the printing of account information including interest at various interest rates.
Use loops, user defined methods, conditional and relational logic and the basics of OOP to accomplish the objectives of this progam.
Error trapping will be part of your grade so don’t forget to include some basic error trapping logic! Comment your code thoroughly as well for maximum points.
Project Details
For this program you will create two separate Java files within your package, namely AccountHolder and AccountHolderTest.
The AccountHolder file must include the following class field members and data methods to allow for transaction processing.
*Field Name | Field modifier/type |
annualInterestRate | static / double |
balance | double |
*assume all class level variables are declared private
*Method Name | Method (Instance or Static) | Argument | Return Type |
AccountHolder | Constructor | double | none |
deposit | Instance | double | void |
withdrawal | Instance | double | void |
monthlyInterest | Instance | void | void |
modifyMonthlyInterest | Static | double | void |
toString | Instance | void | String |
*assume all methods are declared public
Of course if you would like to add any extra fields or methods in your class(es) feel free
to do so.
Coding detail for this file’s methods must include the following:
1.Allow the constructor to accept an argument representing an initial balance for the Account holder. Set your balance member equal to the value passed via the class constructor. Balances cannot start off negative! Include an error message if this is the situation.
2.Define in your monthlyInterest method body an assignment statement to update the account holders’ balance to be effected as follows:
balance += balance * (annualInterestRate / 12.0);
3.Define in your modifyMonthlyInterest method body an assignment statement to update the annualInterestRate amount with some argument value (ex. rateUpdate) that gets passed thru the method as follows:
annualInterestRate = rateUpdate;
Be sure that the updated rate passed thru the method’s parameter is a valid rate
that is greater than or equal to 0 and less then or equal to 1.0.
4.For your deposit & withdrawal methods either have your method body either increase or decrease the holder’s current balance accordingly.
Some added rules to follow here:
a. Do not allow the withdraw to decrease the holder’s balance below $100. Inform the user of of this if this is the situation.
b. If a withdrawal allows the account balance to drop below $500, a one time transaction fee of $50 will be deducted from the current account holder’s balance.
5. For your toString method, include the following statement
return String.format("$%.2f", balance);
6. Fully document your methods. Include comments on what your method is to perform, what parameters (i.e. data types) are to be passed in if any, and what will be returned by the method if anything.
The AccountHolderTest file must include the following transactional detail from your main method, executed in the following order
1.Prompt the user for an intial account balance (have the balance passed into the AccountHolder constructor).
2.Prompt the user to enter in a deposit amount.
3.Prompt the user for a withdrawal amount.
4.Show an example when a user enters a withdrawal that will drop their balance
below $100.
5.Allow the interest for the bank to be initially set at 4%.
6.Display in a columnar format, a report showing interest being added to the users account over a period of 12 months.
Have one column display the month number and one column to show the respected new calculated balance for each particular month. Label your column headings appropriately.
Note- you can easily allow for any new balances to print merely by passing your AccountHolder object via your output statement (by doing so you trigger your toString method you defined in your AccountHolder class automatically which returns the accounts current balance).
7. Update the interest amount once again to 5%.
8. Display a report of balances for a twelve month period with a current interest rate applied at 4% then show an updated balance with an updated interest rate of 5%.
A sample display showing new balances for a twelve month period and an updated balance at the end given a new interest rate is shown below. Note- included in the display is the word ‘Base’ to depict what the current balance is in the account as a starting point.
After you fully have tested your app, modify your program output to display the current date and time and your name at the end of your output. To do so include the following code:
String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar.getInstance().getTime());
System.out.println("Cur dt=" + timeStamp + "Programmed by Sammy Student");
Make sure to change to your name as Programmer.
You will need to import in the following to allow for the methods to be acceptable.
import java.text.SimpleDateFormat;
import java.util.Calendar;
Note you can always go to your menu and choose Source>Organize Imports to automatically include the necessary import statements for your program application!!!
Please include this code to print the date and time plus your name for all your labs herein including your final project as well.
Monthly balances for one year at .04 Balances: Account Balance w. Interest $2000.00 $2006.67 $2013.36 $2020.07 $2026.80 Base Month 1: Month 2: Month 3: Month 4: Month 5: $2033.56 $2040.33 $2047.14 $2053.96 Month 6: Month 7: Month 8: Month 9: Month 10: $2060.81 $2067.68 $2074.57 $2081.48 Month 11: Month 12: After setting interest rate to .05 and calculating monthly interest Balances: Account Balance w. Interest $2090.16
Step by Step Solution
3.49 Rating (162 Votes )
There are 3 Steps involved in it
Step: 1
AccountHolder class public class AccountHolder private static double annualInterestRate private doub...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
635e18eb307c1_181435.pdf
180 KBs PDF File
635e18eb307c1_181435.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started