Class Transaction

java.lang.Object
makingtransactions.Transaction

public class Transaction extends Object
A class for creating transactions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Transaction(String transactionName)
    Create a transaction without any credit and debit.
    Transaction(String transactionName, double debit, double credit)
    Create a transaction with credit and debit.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the crebit (How much money should be spent) for the transaction.
    double
    Get the debit (How much money should be earned) for the transaction.
    Get the name of the transaction.
    void
    setCredit(double credit)
    Set the credit (How much money should be spent) for the transaction.
    void
    setDebit(double debit)
    Set the debit (How much money should be earned) for the transaction.
    void
    setTransactionName(String transactionName)
    Set the name of the transaction.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Transaction

      public Transaction(String transactionName, double debit, double credit)
      Create a transaction with credit and debit.
      Parameters:
      transactionName - The name of the transaction.
      debit - How much money should be earned.
      credit - How much money should be spent.
    • Transaction

      public Transaction(String transactionName)
      Create a transaction without any credit and debit.
      Parameters:
      transactionName - The name of the transaction.
  • Method Details

    • getTransactionName

      public String getTransactionName()
      Get the name of the transaction.
      Returns:
      The name of the transaction.
    • setTransactionName

      public void setTransactionName(String transactionName)
      Set the name of the transaction.
      Parameters:
      transactionName - The name of the transaction.
    • getDebit

      public double getDebit()
      Get the debit (How much money should be earned) for the transaction.
      Returns:
      The debit for the transaction.
    • setDebit

      public void setDebit(double debit) throws IllegalArgumentException
      Set the debit (How much money should be earned) for the transaction.
      Parameters:
      debit - The debit applied to the transaction.
      Throws:
      IllegalArgumentException - If the debit is a negative number.
    • getCredit

      public double getCredit()
      Get the crebit (How much money should be spent) for the transaction.
      Returns:
      The credit for the transaction.
    • setCredit

      public void setCredit(double credit) throws IllegalArgumentException
      Set the credit (How much money should be spent) for the transaction.
      Parameters:
      credit - The credit applied to the transaction.
      Throws:
      IllegalArgumentException - If the crebit is a negative number.
    • toString

      public String toString()
      Overrides:
      toString in class Object