Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help in writing a P-Code, UML diagram and Html for the following code please. --------------Bank Account--------------------------- public abstract class Bank_Account { private double

I need help in writing a P-Code, UML diagram and Html for the following code please.

--------------Bank Account---------------------------

public abstract class Bank_Account { private double accountBalance,interestRate,serviceChargesMonthly; private int numOfDeposit,numOfWithdrawal; // Number of deposite and withdrawals

public BankAccount(double AccBalance, double IntrestRateann , double SCMonthly) { accountBalance = AccBalance; interestRate = IntrestRateann; serviceChargesMonthly = SCMonthly; numOfDeposit = 0; numOfWithdrawal = 0; }

public void deposit(double amountNum) // This method makes a deposit into the account. { accountBalance += amountNum; numOfDeposit++; }

public void withdraw(double amountNum) //This method withdraws an amount from the account. { accountBalance -= amountNum; numOfWithdrawal++; }

private void calcInterest() // this matheod is to calculate the monthly interest. { double interestRateMonthly = interestRate / 12; double monthlyInterest = accountBalance * interestRateMonthly; accountBalance += monthlyInterest; }

public void monthlyProcess() // this method is for monthly expences. { accountBalance -= serviceChargesMonthly; calcInterest(); numOfDeposit = 0; numOfWithdrawal = 0; }

public void setServiceChargesMonthly(double serCharMonthly) { serviceChargesMonthly = serCharMonthly; }

public double getAccountBalance() // returns the Accbalance { return accountBalance; }

public int getNumOfDeposit() // return the number of deposites { return numOfDeposit; }

public int getNumOfWithdrawal() // return the number of withdrawal { return numOfWithdrawal; }

public double getInterestRate() // returns the Annual interest rate. { return interestRate; }

public double getServiceChargesMonthly() { return serviceChargesMonthly; } }

---------------------Savings Account------------------------------------------------

public class SavingsAccount extends BankAccount // this class link both accounts { private boolean status; // Active or inactive

public SavingsAccount(double AccBalance, double intrestRate, double SCMonthly) { super(AccBalance, intrestRate, SCMonthly); if (AccBalance < 25.0) { status = false; // Inactive } else { status = true; // Active } }

public void withdraw(double amountNum) { if (status) { super.withdraw(amountNum); if (getAccountBalance() < 25) { status = false; } } }

public void deposit(double amountNum) { super.deposit(amountNum); if (!status) { if (getAccountBalance() >= 25) { status = true; } } }

public void monthlyProcess() { double SCharMonthly; // Monthly service charge if (getNumOfWithdrawal() > 4) {

SCharMonthly = getServiceChargesMonthly();

setServiceChargesMonthly(SCharMonthly + (getNumOfWithdrawal() - 4)); super.monthlyProcess(); setServiceChargesMonthly(SCharMonthly); } else { super.monthlyProcess(); } } public boolean isStatus() { return status; } public void setStatus(boolean status) { this.status = status; } }

---------------------Savingstest--------------------------------------

import java.text.DecimalFormat;

public class Savingtest { public static void main(String[] args) { DecimalFormat dollar = new DecimalFormat("#,##0.00");

SavingsAccount savAccount = new SavingsAccount(100.0, 0.03, 2.50); // this creata a savingaccount which has 100 dollar balance, 3% intrest, $2.50 of charge monthly.

// shows account detail System.out.println("Account Balance: $" + dollar.format(savAccount.getAccountBalance())); printStatus(savAccount.isStatus()); System.out.println("Number of deposits: " + savAccount.getNumOfDeposit()); System.out.println("Number of withdrawals: " + savAccount.getNumOfWithdrawal()); System.out.println("===================================="); System.out.println();

// Make deposits. savAccount.deposit(25.00); savAccount.deposit(10.00); savAccount.deposit(35.00);

// shows what transfers has be done so far. System.out.println("===================================="); System.out.println("Balance: $" + dollar.format(savAccount.getAccountBalance())); printStatus(savAccount.isStatus()); System.out.println("Number of deposits: " + savAccount.getNumOfDeposit()); System.out.println("Number of withdrawals: " + savAccount.getNumOfWithdrawal()); System.out.println("===================================="); System.out.println();

savAccount.withdraw(100.00); savAccount.withdraw(50.00); savAccount.withdraw(10.00); savAccount.withdraw(1.00); savAccount.withdraw(1.00);

System.out.println("===================================="); System.out.println("Balance: $" + dollar.format(savAccount.getAccountBalance())); printStatus(savAccount.isStatus()); System.out.println("Number of deposits: " + savAccount.getNumOfDeposit()); System.out.println("Number of withdrawals: " + savAccount.getNumOfWithdrawal()); System.out.println("===================================="); System.out.println();

// shows monthly processing. savAccount.monthlyProcess();

System.out.println("===================================="); System.out.println("Balance: $" + dollar.format(savAccount.getAccountBalance())); printStatus(savAccount.isStatus()); System.out.println("Number of deposits: " + savAccount.getNumOfDeposit()); System.out.println("Number of withdrawals: " + savAccount.getNumOfWithdrawal()); System.out.println("===================================="); System.out.println(); } public static void printStatus(boolean status) { if(status) { System.out.println("Status of the account is :ACTIVE"); } else { System.out.println("Status of the account is :INACTIVE"); } } } //end class

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

Students also viewed these Accounting questions

Question

How would we like to see ourselves?

Answered: 1 week ago