![]() |
|
#1
|
|||
|
|||
BOOKEEPING program, HELP!!Hey everyone, i have to write a program that does the following. I know basic C language but i obviously need more to write this program. If someone could help me out it would be most appreciated. Here are the program specs:
You are to write a very basic bookkeeping program that allows the user to enter a series of transactions and to display both a general journal and a balance sheet. Your program identifies account numbers from 1000 to 1999 as asset accounts, from 2000 to 2999 as liability accounts, and from 3000 to 3999 as equity accounts. Your program displays a menu that offers the user four options: * enter a transaction * view the general journal * view the balance sheet * quit the program If the user chooses to enter a transaction, then your program prompts the user for * an account number (between 1000 and 3999) * the transaction type - whether the transaction is a debit or a credit * the amount of the transaction (always a positive number) If the user enters the account number for the very first time, your program adds the new account to the chart of accounts. Once the user has entered the transaction details, your program returns to the menu. If the user chooses to view the general journal, then your program displays all transactions that have been entered, in the order entered. The format of the general journal is as follows: General Journal Account Description Debit Credit ------- ------------------------------ ---------- ---------- 1400 3500.00 2100 3500.00 1000 3000.00 1100 1000.00 1400 2000.00 3100 4000.00 3200 2000.00 1000 2100.99 1300 2100.99 There are 30 blank spaces for each transaction description. If the user chooses to display the balance sheet, then your program displays the balances for all accounts for which transactions have been entered. Your program calculates each account balance by starting at zero and accumulating for that account the amount from each transaction in the general journal. The format for the balance sheet is as follows: Balance Sheet Account Description Debit Credit ------- ------------------------------ ---------- ---------- 1400 1500.00 1000 899.01 1100 1000.00 1300 2100.99 ---------- ---------- Total Assets 5500.00 2100 3500.00 ---------- ---------- Total Liabilities 3500.00 3100 4000.00 3200 2000.00 ---------- ---------- Total Equity 2000.00 ---------- ---------- Total Liabilities and Equity 5500.00 There are 30 blank spaces for each account description. Note the subtotals for the account types - assets, liabilities and equity - and the sum of the liability and equity accounts. You may assume a maximum of 20 transactions and a maximum of 10 different accounts. These limits will allow you to display each of the general journal and the balance sheet on a 24-line screen. Your program allows for gaps in the account numbering, has good error checking, and prompts the user to re-enter unacceptable data (such as non-numeric input for numeric fields or account numbers outside the range 1000-3999). Your program is also well modularized, well commented and readily open to changes in the account type ranges, the maximum number of transactions and the maximum number of accounts. PS i know the chart formatting is all messed up but you get the deal. |
|
#2
|
|||
|
|||
Re: BOOKEEPING program, HELP!!here is my code thus far
CPP / C++ / C Code:
Last edited by LuciWiz : 17-Nov-2006 at 10:50.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#3
|
|||
|
|||
Re: BOOKEEPING program, HELP!!Your variables such as account_number, trans_type, trans_amount etc should really be in a structure. You can then write the whole thing out to a file for later retrieval.
Then later, having read the record(s) back into a structure, or array of structures, you will be able to do whatever calculations are necessary in order to present a journal or balance sheet to the user. The memory for the structures would best be allocated dynamically with the malloc or calloc function. |
|
#4
|
|||
|
|||
Re: BOOKEEPING program, HELP!!hey man i helped you out a little,
in your code you forgot a couple things. First of all, make sure that you flush the buffer using the fflush(stdin); statement, which i added to the first of your scanfs. Second of all, your problem with the credit or debit checker is a logic problem. think of it in english, if trans_type is not equal to 'c' or if trans_type is not equal to 'd' then do this... which means that the statement can never be false! even if you enter 'c' or 'd' as an answer, the opposite will hold true. so even if you pick credit, it not equal to d, so the statement is true. i switched the or to an and (|| to &&) and it worked perfectly. I made it look a little bit better XD. heres your code: CPP / C++ / C Code:
see yazz, HACKin Last edited by LuciWiz : 17-Nov-2006 at 10:51.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#5
|
|||
|
|||
Re: BOOKEEPING program, HELP!!I am still at a very basic level of C programming so i need more information if thats possible. some examples perhaps. Thanks alot.
|
|
#6
|
|||
|
|||
Re: BOOKEEPING program, HELP!!Personally, if I was writing a book keeping program, I would also want to keep a record of what the transaction was for, and who the buyer/seller was. Those details would also be included in your structure of course.
|
|
#7
|
|||
|
|||
Re: BOOKEEPING program, HELP!!well i didnt expand on what you needed to do, i just fix your orignal code.
you just didnt clear the stdin buffer that the OS uses. When you use scanf, it doesnt remove the enter keypress from the input, so its stuck there in the buffer still. of course when you read into your variable it removes the enter keypress, but the next input operation will automaticlly pass on because of that annoying enter XD |
|
#8
|
|||
|
|||
Re: BOOKEEPING program, HELP!!Ok, here's a structure definition:
typedef struct { int account_number; int trans_type; float trans_amount; char details[50]; //for office chairs, new PC, etc. char custsel[ 50 ]; //name of buyer or seller } RECORD; Now declare a variable of type RECORD, and for each transaction store the data in that variable (structure) before writing it out to a file with the fwrite function, and, later, reading them back in with the fread function. |
|
#9
|
|||
|
|||
Re: BOOKEEPING program, HELP!!hey, okay so my real problem is that i dont know what to do with the user input when i collect it.... say the user tells me its account number 1900, its a debit , and its value is 4500..... i dont know how to go about accepting these values and placing them properly in a the chart. I need to be able to do this with multiple entries... im totally lost!
|
|
#10
|
||||
|
||||
Re: BOOKEEPING program, HELP!!Quote:
And you all need to read the Guidelines, especially #1. __________________
Age is unimportant -- except in cheese |
Recent GIDBlog
Meeting the local Iraqis by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pipeline freeze simulation | darklightred | C++ Forum | 6 | 27-Jul-2006 19:37 |
| How to read particular memory location ? | realnapster | C Programming Language | 10 | 10-May-2006 09:11 |
| creating a file in [c] | i hate c | C Programming Language | 15 | 21-Nov-2005 12:52 |
| Type casts ? | kai85 | C++ Forum | 12 | 23-Jun-2005 12:04 |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 07:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The