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

use java please 2. Modify the BankAccount class previously created to add two me

ID: 3705255 • Letter: U

Question


use java please

2. Modify the BankAccount class previously created to add two methods: deposit and withdraw. These will be used to deposit of withdraw money from the bank account. Extend the BankAccount class to create two types of bank accounts: a checking account and a savings account. These will inherit the properties of bank account class, but have the following unique behavior: when money get deposited into the savings account, an automatic 1% interest is added to the deposited amount The savings account does not allow withdraw When money get withdrawn from the checking account, a withdrawing fee of $1 is applied. To test the functionalities of the BankAccount, CheckingAccount and SavingsAccount classes a class called BankTest will be created. This class will have a main method which will be used to: Lab 8: Classes (GUI) Create at least one instance of each bank account type, i.e BankAccount, CheckingAccount and SavingsAccount Deposit/withdraw money from these accounts Display (output) the balance and interest values from these accounts

Explanation / Answer

BankAccount.java

package banktest;

import java.util.Scanner;


public class BankAccount {
  
public float amount,w_amount;
  
public void deposit()
{
System.out.println("Please enter amount to deposit:");
Scanner sc1 = new Scanner(System.in);
amount = sc1.nextFloat();
  
System.out.println("The amount deposited by you is:" + amount);
}
  
public void withdrawal()
{
System.out.println("Please enter the withdrawal amount:");
Scanner sc2 = new Scanner(System.in);
w_amount = sc2.nextFloat();
amount = amount - w_amount;
  
System.out.println("Your withdrawal amount is:" + w_amount);
System.out.println("Your remaining deposit amount is:" + amount);
  
}
  
}

_____________________________________________________________________________________________

Saving_account.java


package banktest;

import java.util.Scanner;


public class Saving_account extends BankAccount {
  
public float i_amount,total_deposit;
  
public void deposit()
{
System.out.println("Please enter amount to deposit:");
Scanner sc1 = new Scanner(System.in);
amount = sc1.nextFloat();
i_amount = (float) (0.01 * amount);
total_deposit = amount + i_amount;
  
System.out.println("Your deposit amount is:" + amount);
System.out.println("Interest applied to the deposit amount:" + i_amount);
System.out.println("Your total deposit is:" + total_deposit);
}
  
public void withdrawal()
{
System.out.println("Withdrawal is not allowed with Saving account");
}
}

_______________________________________________________________________________________________

Checking_account.java


package banktest;

import java.util.Scanner;


public class Checking_account extends BankAccount{
  
public float withdrawing_fee=1,total_wamount;
  
public void withdrawal()
{
System.out.println("Please enter the withdrawal amount:");
Scanner sc2 = new Scanner(System.in);
w_amount = sc2.nextFloat();
total_wamount = w_amount + withdrawing_fee;
amount = amount - total_wamount;
  
System.out.println("Your withdrawal amount is:" + w_amount);
System.out.println("Withdrawing fees applied is:" + withdrawing_fee);
System.out.println("Total withdrawal amount is:" + total_wamount);
System.out.println("Your remaining deposit amount is:" + amount);
}
  
}

______________________________________________________________________________________________

BankTest.java


package banktest;


public class BankTest {


public static void main(String[] args) {
  
  
System.out.println("Deposit in a basic Bank Account");
  
BankAccount ba = new BankAccount();
ba.deposit();
ba.withdrawal();
  
System.out.println("_______________________________________________________");
  
System.out.println("Deposit in a Savings Account");
  
Saving_account sa = new Saving_account();
sa.deposit();
sa.withdrawal();
  
System.out.println("________________________________________________________");
  
System.out.println("Deposit in a Checking Account");
  
Checking_account ca = new Checking_account();
ca.deposit();
ca.withdrawal();
}
  
}