Question: Java Programming. Thanks in advance. Please share the screenshot of the output. Java Programming. The Account class It provides basic methods for creating bank accounts,

Java Programming. Thanks in advance. Please share the screenshot of the output.
Java Programming. The Account class It provides basic methods for creating bank accounts, depositing funds, withdrawing funds, and retrieving the account balance public class Account private double balance ll Constructor to initialize balance public Account( double amount) {balance amount, Il Overloaded constructor for empty balance public Accounto Ithis(0.0) public void deposit double amount) balanceamount public void withdraw( double amount) (balance-amount, public double getBalance) { return balance Create a new class called SafeAccount that extends Account. The new class should include the following methods 1) a constructor that accepts the initial balance. If the initial balance is negative, the account should be created with an initial balance of zero 2) a method to override the inherited deposit method. If the amount passed as argument is negative, the method should have no effect on the balance 3) a method to override the inherited withdraw method. If the amount passed as argument exceeds the available balance, the method should have no effect on the balance (in other words, the withdrawal attempt should be ignored). 4) a method overdraftAttempts that returns an int representing the number of withdraw operations that were ignored because of insufficient funds Use AccountDemo.java to test your class. Observe the output carefully class AccountDemot public static void main(String argsIX Il Create an empty account SafeAccount myAccount new SafeAccount(10); myAccount.deposit(320.00) System.out.printf ("Current balance: $%7.2tin".myAccount.getBalance()); myAccount.withdraw(80.00); System.out printf ("Remaining balance: $%7.2f. Overdraft Attempts. %dn", myAccount.getBalance), myAccount.overdraftAttemptsO) myAccount.deposit(-100.00) System.out.printf ("Remaining balance: $%7.2f. Overdraft Attempts: 96d.in", myAccount.getBalance0, myAccount.overdraftAttempts)) myAccount.withdraw(800.00); System.out.printf ("Remaining balance: $%7.2f. Overdraft Attempts. %d.in.", myAccount.getBalance), myAccount.overdraftAttemptsO)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
