Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this program you will create two separate Java files within your package, na

ID: 3881443 • Letter: F

Question

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 holders’balance 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 method’sparameter 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 holder’s current balance accordingly.

Some added rules to follow here:

Do not allow the withdraw to decrease the holder’s 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 holder’s 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.

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 ");

*Field Name

Field modifier/type

annualInterestRate

static / double

balance

double

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

Explanation / Answer

Hi,

Please find answer for your question,

Program :

AccountHolder.java

public class AccountHolder {

private static double annualInterestRate;

private double balance ;

//arguemnted constructor

AccountHolder(double balance){

this.balance=balance;

}

//default constructor or zero param constructor

AccountHolder(){

}

//deposite method

public void deposit(double bal){

double temp=(bal)*(annualInterestRate/100);

this.balance += temp+bal;

}

//withdrawal amount

public void withdrawal(double bal){

double temp1= balance-bal;

double temp2= balance-bal;

if(temp1 <= 100){

System.out.println("Withdraw amount is invalid. please maintain balance amount minmimum of $100 ");

System.exit(0);

}else if (temp2 <= 500){

balance = balance-50;

System.out.println(" deducted one time transaction fee $50 ");

}else{

this.balance -= bal;

}

}

//monthly interest

public void monthlyInterest(){

balance +=balance *(annualInterestRate/12.0);

}

//modifyMonthly intrest

public static void modifyMonthlyInterest(double rateUpdate){

annualInterestRate =rateUpdate;

}

@Override

public String toString() {

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

}

public static double getAnnualInterestRate() {

return annualInterestRate;

}

public static void setAnnualInterestRate(double annualInterestRate) {

AccountHolder.annualInterestRate = annualInterestRate;

}

public double getBalance() {

return balance;

}

public void setBalance(double balance) {

this.balance = balance;

}

}//class ends

AccountHolderTest.java

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Calendar;

import java.util.Scanner;

public class AccountHolderTest {

AccountHolderTest(){

}

public static void main(String[] args) {

AccountHolder holder=new AccountHolder();

holder.setAnnualInterestRate(4);

System.out.println("Initial Account Balance : ");

Scanner sc=new Scanner(System.in);

double initialAccBalance = sc.nextDouble();

AccountHolder holder1=new AccountHolder(initialAccBalance);

ArrayList al=new ArrayList();

for(int i=0;i<12;i++){

holder1 = new AccountHolder();

System.out.println("Deposite Amount : ");

double depositeBalance = sc.nextDouble();

holder1.deposit(depositeBalance);

System.out.println("Withdraw Amount : ");

double withDrawBalance = sc.nextDouble();

holder1.deposit(withDrawBalance);

//System.out.println(holder1);

al.add(holder1);

}

System.out.println("Monthly Balances for one Year at .04");

System.out.println("Balances :");

System.out.println("Account Balance w.Interest ");

System.out.println("Base "+holder1.getBalance());

int month=1;

for(int j=0;j<al.size();j++){

System.out.println("Month "+month+" : "+al.get(j));

month++;

}

String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar.getInstance().getTime());

System.out.println("Cur dt=" + timeStamp + " Programmed by Sammy Student ");

System.out.println();

}

}//class ends

OUTPUT:

javac *.java

java AccountHolderTest

Initial Account Balance :
1000
Deposite Amount :
200
Withdraw Amount :
100
Deposite Amount :
300
Withdraw Amount :
60
Deposite Amount :
100
Withdraw Amount :
800
Deposite Amount :
1000
Withdraw Amount :
200
Deposite Amount :
100
Withdraw Amount :
200
Deposite Amount :
1000
Withdraw Amount :
200
Deposite Amount :
1000
Withdraw Amount :
200
Deposite Amount :
600
Withdraw Amount :
100
Deposite Amount :
400
Withdraw Amount :
100
Deposite Amount :
600
Withdraw Amount :
300
Deposite Amount :
400
Withdraw Amount :
100
Deposite Amount :
400
Withdraw Amount :
100
Monthly Balances for one Year at .04
Balances :
Account Balance w.Interest
Base 520.0
Month 1 : $312.00
Month 2 : $374.40
Month 3 : $936.00
Month 4 : $1248.00
Month 5 : $312.00
Month 6 : $1248.00
Month 7 : $1248.00
Month 8 : $728.00
Month 9 : $520.00
Month 10 : $936.00
Month 11 : $520.00
Month 12 : $520.00
Cur dt=2018/02/01 08:04:13
Programmed by Sammy Student

Thank You.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote