Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this program you will create two separate Java files within your package, namely AccountHolder and AccountHolderTest . The AccountHolder file must include the following

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 fieldmembers 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 addany extra fields or methods in your class(es)feel free

to do so.

Coding detail for your methodsmust include the following:

Allow the constructor to accept an argument representing an initialbalance 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.

Define in your monthlyInterestmethod body an assignment statement to update the account holdersbalance to be effected as follows:

balance += balance * (annualInterestRate / 12.0);

Define in your modifyMonthlyInterest method body an assignment statement to update the annualInterestRateamount 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 methodsparameter is a valid rate

that is greater than or equal to 0 and less then or equal to 1.0.

For your deposit & withdrawal methods either have your method body either increase or decrease the holders current balance accordingly.

Some added rules to follow here:

Do not allow the withdraw to decrease the holders balance below $100.

Inform the user of of this if this is the situation.

If a withdrawal allows the account balance to drop below $500, a one time transaction fee of $50 will be deducted from the currentaccount holders balance.

For your toString method, include the following statement

return String.format("$%.2f", balance);

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.

--For yourAccountHolderTest file,include any local variables in main to work the application. Include the following transactional detail fromyour main method,executed in the following order

Allow the interest for the bank to be initially set at 4%.

Create an AccountHolder object and prompt the user for an intial account balanceand have the balance passed into the AccountHolder constructor.

Prompt the user to enter in a deposit amount.

Prompt the user for a withdrawal amount.Show an example when a user enters a withdrawal that will drop their balance below $100.

Display in a columnar format,a report showing interest being added to the users current account balance amount 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.

- you can easily allow for any new balances to print by passing your AccountHolder object via your output statement which auto triggers yourtoStringmethod defined in the AccountHolder classto returns the accounts current balance.

A sample display showing new balances for a twelve month period. Note-includedin the display is the word Base to depict what the current balance is in the account as a starting point.

image text in transcribed

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 (as shown above). 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 ");

Console 23 cterminatedAccountoldeest Java Application) LibrarylJava/JavaVirtualMachinesjdk1.8.0151.jdkContents/Home/bin/ava (Jan 13, 2018, 10:06:35 PM) Monthly balances for one year at .04 Balances Account Balance w. Interest Base $2000.00 Month 1: $2006.67 Month 2: $2013.36 Month 3: $2020.07 Month 4:$2026.80 Month 5: Month 6: Month 7: $2047.14 Month 8: $2053.96 Month 9: Month 10: $2067.68 Month 11: $2074.57 Month 12 $2081.48 $2033.56 $2040.33 $2060.81 Cur dt-2018/01/13 22:06:36 Programed by S Student

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

What is the purpose of a data communications standard?

Answered: 1 week ago