Can someone please help me with this program I'm trying to create, I'm new to java and am a bit stuck ..
I created a BankAccount class and want the following capabilities. The bank will be charging a fee for every deposit and withdrawal. Supply a mechanism for setting the fee and modify the deposit and withdraw methods so that the fee is levied. Test your resulting class and check that the fee is computed correctly.
The bank will allow a fixed number of free transactions (7 deposits or withdrawals) every month, and charge for transactions exceeding the free allotment. The charge is not levied immediately but at the end of the month.
Supply a new method deductMonthlyCharge to the BankAccount class that deducts the monthly charge and resets the transaction count.
Produce a test program that verifies that the fees are calculated correctly over several months.
Enable user input for each program. The input will be used to create the objects.
Program continues to loop until user chooses to Quit.
My current code:
//Main
package bank;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
BankAccount david = new BankAccount();
System.out.println(david.getBalance() + " is the balance!");
System.out.println("how much d");
String deposit = in.next();
david.makeDeposit (double deposit)
david.makeWithdrawl(50);
System.out.println(david.getBal/ance() + " is the balance!");
BankAccount jonathan = new BankAccount(125779, 768.34, "Jonathan", "Checking");
System.out.println(jonathan.getBalance() + " is the balance!");
}
}
//Class
package bank;
public class BankAccount {
private int accountNumber;
private int fee=20;
private double balance;
private String name;
private String typeOfAccount;
public BankAccount()
{
accountNumber = 0;
balance = 0;
name = "No Name";
typeOfAccount = "None";
}
//Default constructor
public BankAccount(int accountNumber, double balance, String name,
String typeOfAccount)
{
this.accountNumber = accountNumber;
this.balance = balance;
this.name = name;
this.typeOfAccount = typeOfAccount;
}
//Deposit!
public double makeDeposit(double deposit)
{
balance = balance + deposit - fee;
//balance += deposit;
return balance;
}
//Withdrawl!
public void makeWithdrawl(double withdrawl)
{
balance = balance - withdrawl - fee;
}
//Get balance!
public double getBalance()
{
return balance;
}
}
As you can see I'm probably way off :/ please helps me I would really like to get this done by Monday or as soon as possible.. Thank you very muchs :]