well i need to create a class called Transaction, this class purpose
is to store data for individual transactions. it also needs to
reference to the account object that i have which will be affected by
the transaction, amount of the transaction. so like when some one
takes money out of a cheque account they are hit with a 10 cent fee
wich is debited from thier account,
or when its a eftcard account that they have taken money out of their
account it is ckecked to see if they have a balance of $500,000 or
less they have a interest rate of 3% but if its 4% if its over
500,000.
well this to me is a bit confusing so please what whould i need to do?
my other classes that are included
private String accType = "";
private String accNo = "";
private double balance;
private double intRate= 0.0;
//constructors to initialise all varibles
// of the account
Account (){}
// } // this the end of the initialising of the first constructor
//constructors set parameters of the account
Account (String aType, String aNo, double aBal, double aRate ){
accType = aType;
accNo = aNo;
balance = aBal;
intRate = aRate;
} // this the end of the initialising of the second constructor
// setting the set methods to assign values
public void setAccType(String a) {
accType = a;
}
public void setAccNo(String a) {
accNo = a;
}
public void setBalance(double a) {
balance = a;
}
public void setIntRate(double a) {
intRate = a;
}
//settig the get methods to return the values
public String getAccType() {
return accType;
}
public String getAccNo() {
return accNo;
}
public double getBalance() {
return balance;
}
public double getIntRate() {
return intRate;
}
} // end of Account class
***********************************************
public class EFTCard extends Account {
// constructor that'll initialise n set parameters
EFTCard () { }
//constructor that will use the super class and set the values
EFTCard (String aType, String aNo, double aBal, double aRate ){
super (aType, aNo, aBal, aRate);
} // end of constructor initialise n set parameters
}
**************************************************************
public class Cheque extends Account {
//could have a private string for withdrawal so check that will need
//i could put it in the transaction class
// constructor that'll initialise n set parameters
Cheque () { }
//constructor that will use the super class
Cheque(String aType, String aNo, double aBal, double aRate ){
super(aType, aNo, aBal, aRate);
//should i have this for the set the interest rate to 2%
//public void setIntRate(double a) {
this.setIntRate(0.02);
} // end of constructor initialise n set parameters
****************************************************************
hey i have done a bit of code on the interface
if (obj == btnAddData) {
//this if for when user enters a transaction amount
if (txtTranxAmount.getText().equals("")){
double TrnAmt = Double.parseDouble(txtTranxAmount.getText());
if (accountType.getSelectedCheckbox().getLabel().equals("Cheque")) {
Cheq.setBalance(Cheq.getBalance() + TrnAmt )
} else{
if (accountType.getSelectedCheckbox().getLabel().equals("EFTCard")) {
Eft.setBalance(Cheq.getBalance() + TrnAmt )
}//end of the if it was eftcard
if ((Cheq == null) && (Eft == null ))
System.out.println("NO AMOUNT WAS ENTERED FOR A TRANSACTION");
// no AMOUNT WAS ENTERED FOR A TRANSACTION
//this if statement is here so is a user wants to create a an account
they must enter a clientno
if (! txtClientNo.getText().equals("")) {
Clt = new Client(txtClientNo.getText(), txtFirstname.getText(),
txtSurname.getText(), txtClientAge.getText());
if (accountType.getSelectedCheckbox().getLabel().equals("Cheque")) {
double InterestRate = Double.parseDouble(txtInterestRate.getText());
double AccountBalance = Double.parseDouble(txtAccountBalance.getText
());
Acc = new Cheque(promptAccType.getText(),txtAccountNo.getText(),
AccountBalance, InterestRate);
} else {
if (accountType.getSelectedCheckbox().getLabel().equals("EFTcard")) {
double InterestRate = Double.parseDouble(txtInterestRate.getText());
double AccountBalance = Double.parseDouble(txtAccountBalance.getText
());
Acc = new EFTCard(promptAccType.getText(),txtAccountNo.getText(),
AccountBalance, InterestRate);
} // THIS closes the if statement of the if equals bit
Brh = new Branch (branchArray[availableBranches.getSelectedIndex
()].getBranchName(),
branchArray[availableBranches.getSelectedIndex()].getBranchCode());
}
} else {
System.out.println("PLEASE ENTER A CLIENT NUMBER");
// no client number
}
} // end of if for btnAddData