• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

final pt.

one more thing guys.....i managed to come out with this for transaction.java...no sure with the condition part....wld appreciate the knowledge in that...many thanks.
public class Transaction {

  private String recordTrans ;
  private String accountNumber1 ;
  private String accountNumber2 ;
  private double amt ;
  private Calendar date ;
  private String type ;

     Calendar date;
     private Object rec;
     
     public Transaction(){
     
     }
     
     public addRecord(String type, double amt){
                   
I AM STUCK HERE!!!!
         
          recordTrans = date.getDate() + " " + transType + " " + amount;          
          date.tock(7);
          return recrecordTrans;
     }
}
0
basgen
Asked:
basgen
1 Solution
 
CEHJCommented:
Your addRecord is in the wrong class. It should be in a class owning a collection of Transaction, not in Transaction itself
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
Can you be more clear by what you meant by " I AM STUCK HERE!!!!  ". what exactly are you trying to do?
0
 
objectsCommented:
first add setters and getter to your class

public class Transaction {

  private String recordTrans ;
  private String accountNumber1 ;
  private String accountNumber2 ;
  private double amt ;
  private Calendar date ;
  private String type ;

     Calendar date;
     private Object rec;
     
     public Transaction(){
     
     }

     public void setType(String type) {
        this.type = type;
     }

     public String getType() {
        return type;    
    }

     // do the same for the other member variables
}

The to create a Transaction use:

Transaction tx = new Transaction();
tx.setType("xxx");
tx.setDate(Calendar.getInstance());
// set other properties as required

You can then add the create Transaction object where needed
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
basgenAuthor Commented:
but i still dont understand though...
Transaction tx = new Transaction();
tx.setType("xxx");
tx.setDate(Calendar.getInstance());
// set other properties as required

You can then add the create Transaction object where needed


do i add this bit in the prog...it wont make sense then right..
 pls advise...
0
 
CEHJCommented:
If you're not sure if that answers your question, then why have you accepted an answer?

The answer accepted doesn't particuarly seem to me to tally with your specific comment

>>I AM STUCK HERE!!!!

either ...
0
 
objectsCommented:
> do i add this bit in the prog...it wont make sense then right..

yes you do it in the program or method where u want to create your transaction objects
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now