GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Feb-2009, 04:23
jladd5 jladd5 is offline
New Member
 
Join Date: Feb 2009
Posts: 1
jladd5 is an unknown quantity at this point

Desperately need Help with writing a balance program.


This is my current lab, and to be honest I don't know where to begin. Honestly a step by step deal would be really helpful if possible. I definately don't expect the answer, but I would like it if someone could give me the necessary knowledge to do this with. I'm just getting started in C++, so please give me an answer in lamans terms. Any help is much apprieciated.

Suppose you want to keep your bank transactions on your computer, and you'd rather keep the information as a simple text file that you can manipulate using C++ programs, rather than being slave to Excel or Quicken. You decide to use the following format for your bank transaction file:
The first line will be the starting balance, and the last line will be -1.

All other lines will contain transactions.

There are three types of transactions: Deposits, checks and ATM withdrawals.

Deposit lines are of the form:
Year Month Day Amount

The year, month and day are all integers, and the amount is a positive double.

Check lines are of the form:
Year Month Day Amount Number

The year, month and day are all integers. The amount is a negative double and number is the check number, which is a positive integer.

ATM withdrawal lines are of the form:
Year Month Day Amount 0

The year, month and day are all integers, and the amount is a negative double.

Your program is going to read input in the proper format, and emit a very simple processing of the output. In particular, it is going to print 12 lines of output:


The starting balance.
The ending balance.
A blank line.
The date of the first transaction.
The date of the last transaction.
A blank line.
The number of deposits and total amount of deposits.
The number of checks and total amount of checks.
The number of ATM withdrawals and their total amount.
A blank line.
Your minimum balance during this period.
Your maximum balance during this period.
  #2  
Old 03-Feb-2009, 08:37
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 713
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: Desperately need Help with writing a balance program.


I think the first step you need to do is create a class that can represent your account. It will have several variables, some of which are collections (arrays, lists, etc). The next step would be to write a printing function for printing the contents of this class to the screen. Then, you should write a function to read a text file and convert it to an instance of this class. Here is a start:
CPP / C++ / C Code:
class Account
{
public:

  TransactionCollection Transactions; // this could be a class that you write that is a collection of transactions                                                  
                                                   // I'm thinking maybe a base class called Transaction that has child classes that inherit from it like ATMTransaction       

  void Print(); // method for printing to the screen
  double GetBalance(); // calculate the balance and return it   
  void LoadFromFile( const std::string& FileName );  
};
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Equation solver RazoR C Programming Language 3 18-May-2008 10:24
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 11:13
Text-Based Roulette Game mfm1983 C++ Forum 5 29-Nov-2006 13:20
BOOKEEPING program, HELP!! yabud C Programming Language 10 17-Nov-2006 04:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:46.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.