How do you use methods as args? I can not seem to get the string or file stored in the getters and setters to work as args for the printWriter.etc. Unless something else in this code is causing it. all the getters and setters work everywher else
/*
* CardData.java
*
* Created on October 1, 2007, 11:28 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package creditcard;
//import db.CreditCardService;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import creditcard.ProcessCard;
import tio.FormattedWriter;
import java.io.File;
/**
*
* @author James
*/
public class CardData extends ProcessCard{
private ProcessCard pc;
private File file;
/** Creates a new instance of CardData */
public CardData() throws FileNotFoundException, IOException, SQLException, Exception {
super();
setStatusFileString(getStatusFileName());
setLogFileString(getLogFileName());
}
public void accountStatus() throws IOException, SQLException, Exception{
FileWriter fw=new FileWriter(getStatusFile(),true);
fw.write(("Account Type: "+getAcctType()));
fw.write("Account: " + getAccountNo());
fw.write("Date: "+getDate());
if(AcctType==("Credit")){
fw.write("Credit Limit: " + getCreditLimit());
fw.write("Account Balance: "+getBank());
fw.write("Available Credit: " +getAvailable());
fw.write("Outstanding Balance: " +getBalance());
}
fw.write("Last Transaction was Charge of: " + getCharge()+ "on "+getDate());
fw.write("Description; " + getDescription());
if(AcctType==("Debit")){
fw.write("Last Transaction was charge of: " + getPayment()+ "on "+getDate());
}else{
fw.write("Last Transaction was payment of: " + getPayment()+ "on "+getDate());
fw.write("Total Charges: " + getTotalCharges());
fw.write("Total Payments " + getTotalPayments());
}
}
public void writeLog() throws FileNotFoundException, IOException, SQLException, Exception {
File f = new File(getLogFileString());
FormattedWriter out = new FormattedWriter(new FileWriter(getLogFile().toString(),true));
out.printfln(getAcctType());
out.printfln(getAccountNo());
out.printfln(getDate());
out.printfln(getBank());
out.printfln(getPayment());
if(getPayment()==0.0){
setDescription("Deposit");
}
out.printfln(getDescription());
out.printfln(getPayment());
out.printfln(getDescription());
out.close();
CreditCardService ccs = new CreditCardService();
}
}
Thanks