Here is a summary of my project.
I have a cash for metals company that has both personal and commercial customers.
Customers can alos acumulate interest if they keep their money with the company. Some customers are repeat customers, therefore i need a way to keep track of multiple transactions for a customer.
So far i created the supercalss Customer and subclasses PersonalCustomer and CommercialCustomer that inherit from the superclass. I won't post all the code here because is very very long.
Now i am working on the Account class where i have some trouble. I am still struggling on creating a unique account id for each customer. This is what i have so far, am i on the right track?:
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Account
{
public static final double DEFAULT_ACCOUNT_BALANCE = 0;
public static final double DEFAULT_INTEREST_RATE = .03;
private static long aNumber;
private double balance;
Calendar cal1 = Calendar.getInstance();
public Account()//default
{
balance = DEFAULT_ACCOUNT_BALANCE;
}
public Account (long number, double balance)
{
aNumber = number;
this.balance = balance;
}
public static void setAccount (long number)
{
number = (long)(Math.random()*100000000);
aNumber = number;
}
public void setBalance(double aBalance)
{
balance = aBalance;
}
public double getBalance ()
{
return balance;
}
public long getANumber ()
{
return aNumber;
}
public double getRate()
{
return DEFAULT_INTEREST_RATE;
}
public int getDate()
{
return cal1.get(Calendar.YEAR) + cal1.get(Calendar.MONTH) + cal1.get(Calendar.DAY_OF_MONTH);
}
public String toString()
{
return getClass() + "\nAccount: " + aNumber + " balance: " + balance + " Date: " + cal1;
}
public void makeDeposit (double amount)
{
balance = balance + amount;
return;
}
public double makeWithdrawal(double wAmount)
{
return wAmount;
}
public static void newCustomer (ArrayList<Customer> customers)
{
for (int i = 0; i < customers.size(); i++)
{
}
}
}