Question: Bad Code 01 Some knucklehead coded your new banking application. There are five errors in the file. Find all five errors, fix them, and resubmit
Bad Code 01 Some knucklehead coded your new banking application. There are five errors in the file. Find all five errors, fix them, and resubmit the code back to me for review. The code must compile and run without errors.
Correct Code please. Explain aswell :)
import static java.language.System.*;
public class BankingApplication { public static Vector class BankAccount{ private int accountNumber; private String customerName; private double accountBalance; public BankAccount(){} public BankAcct(int accountNumber, String customerName, double accountBalance){ this.accountNumber=accountNumber; this.customerName=customerName; this.accountBalance=accountBalance; } public void setAccountNumber(int accountNumber) { this.accountNumber=accountNumber; } public int getAccountNumber() { return accountNumber; } public void setCustomerName(String customerName){ this.customerName=customerName; } public String getCustomerName(){ return customerName; } public void setAccountBalance(double accountBalance) { this.accountBalance=accountBalance; } public double getAccountBalance() { return accountBalance; } public void displayAcct(){ out.println("Account#: " + accountNumber + ", Customer Name: " + customerName + ", Balance: $" + accountBalance); } public void deposit(double amount){ out.println(" Previous balance for account " + accountNumber + " was: $" + accountBalance); out.println("Deposit made of: $" + amount); accountBalance+=amount; out.println("New balance for account " + accountNumber + " is: $" + accountBalance); out.println(); } public void withdrawal(double amount){ out.println(" Previous balance for account " + accountNumber + " was: $" + accountBalance); out.println("Withdrawal made of: $" + amount); accountBalance-=amount; out.println("New balance for account " + accountNumber + " is: $" + accountBalance); if (getAccountBalance()<0){ out.println("You are overdrawn. A fee of $ 25.00 has been deducted from your account."); accountBalance-=25.00; out.println("New balance for account " + accountNumber + " is: $" + accountBalance); } out.println(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
