Beginning C++ Bank Statement

Only available on StudyMode
  • Topic: C++, Void type, Return statement
  • Pages : 4 (310 words )
  • Download(s) : 996
  • Published : November 6, 2007
Open Document
Text Preview
Lab 7 Report
CS115
March 21, 2007

#include
#include "Transaction_Class.h"
#include "BankStatement_Class.h"

void main()
{
BankStatement MyStatement;
MyStatement.SetBegBal( 15.92f );

Transaction T1;
T1.SetAmount( 123.56f );
T1.SetCode( 'D' );
T1.SetNote( "CTPay" );
Transaction T2( 153.86f, 'W', "Rent" );
Transaction T3;
T3.SetAmount( 75.56f );
T3.SetCode( 'D' );
T3.SetNote( "Tips" );
Transaction T4( 12.56f, 'D', "Gifts" );
Transaction T5;
T5.SetAmount( 73.74f );
T5.SetCode( 'W' );
T5.SetNote( "Date" );
Transaction T6( 145.75f, 'D', "Loans" );
Transaction T7;
T7.SetAmount( 40.00f );
T7.SetCode( 'W' );
T7.SetNote( "LoanPymt" );
Transaction T8( 21.74f, 'W', "Groceries" );

MyStatement.EnterTransaction(T1);
MyStatement.EnterTransaction(T2);
MyStatement.EnterTransaction(T3);
MyStatement.EnterTransaction(T4);
MyStatement.EnterTransaction(T5);
MyStatement.EnterTransaction(T6);
MyStatement.EnterTransaction(T7);
MyStatement.EnterTransaction(T8);

MyStatement.DisplayResults();
MyStatement.ArrangeTransactions();
MyStatement.PrintArranged();

}

#ifndef BANKSTATEMENT_CLASS_H
#define BANKSTATEMENT_CLASS_H

#include "Transaction_Class.h"

const int MaxTransactions = 10;
class BankStatement
{
public:
BankStatement();// constructor
void SetBegBal(float Balance);// set BegBal
float GetBegBal();// get BegBal
float GetEndBal();// get EndBal
int GetNumEntries();// get Number of entries into statement
void EnterTransaction(Transaction Input);// inserts input transaction into next available
// slot in TransactionLog, updates RunningBal array,
// and adjusts NumEntries and EndBal
void DisplayResults();// display to screen
void ArrangeTransactions();// arrange transactions for printing
void PrintArranged();// print arranged array

private:
Transaction TransactionLog[MaxTransactions];// class Transaction with an array
Transaction...
tracking img