The following is a look at a "real world" example (only parts of the phases are included):
Phase 1 Problem Analysis and Specification
Phase 2 Design
Phase 3 Implementation of the Design (Coding)
Phase 4 Testing, Execution and Debugging
Phase 5 Maintenance
Make a small business accounting system for an accounting service that meets the following specifications:
Statement of the problem.
Sample Data and Print Outs
Profit and Loss Statement
Expense Ledger
Sales Ledger
Program Conditions
Sample screens
Main Menu
Sales Menu
This program was encountered in the early 1980's. An accountant needed some accounting programs written. He had purchased a PC with 64 KB of RAM and a dual floppy 5 1/4" drives. In addition he had a dot-matrix printer. Prior to this project, the company's staff members were using this system to only do word processing.
A franchised computerized accounting service had come to town. They were offering a service similar to what he provided for his clients. They were offering their services at a lower price than he was charging. Their service used the paid out records and the sales records to develop a monthly profit and loss statement. Their service did not include check writing or consultation on the status of the business or what future actions might improve the business performance.
The accountant wanted to computerize his business so that he could compete with the computerized accounting service. He hoped that if he computerized, he could serve more clients in the same amount of time and thereby be able to lower his prices to that of the computerized accounting service.
The accountant had surveyed the computer accounting field and could not find an accounting package which met his needs. His clients were small cash businesses. They had no accounts receivable, no accounts payable and no inventory control needs. He only used a simple single entry general ledger rather than a double entry general ledger for his clients. Most of the software packages he found were double entry ledgers and had far more features than were needed by his clients.
Therefore, he wanted a single entry general ledger program created that was easy to use, would run on his computer, and would duplicate the forms he was currently using (sample forms are included on the next few pages.) He wanted to be able to have several different clients on each floppy. Because he did not want an extensive library and he wanted to be able to call up their past records using their client number. He had two different forms for different types of clients and he wanted two different programs to serve the two types of clients or one program that could be used for all of his customers.
Name:_____________________________ | ||
DBA:______________________________ | ||
Street:______________________________ | ||
City/State:___________________________ | ||
Month of ________ Year:_______________ | ||
======================================================================= | ||
SALES | CURRENT MONTH | YEAR TO DATE |
3.__________________ $______________ | ||
4.__________________ $______________ | ||
5.__________________ $______________ | ||
6.__________________ $______________ | ||
7.__________________ $______________ | ||
1. TOTAL SALES | $________________ | $________________ |
2. OTHER INCOME | $________________ | $________________ |
1&2 GRAND TOTAL | $________________ | $________________ |
==================================== | ||
PURCHASES\ Cost of Sales | ||
8. __________________ $______________ | ||
9. __________________ $______________ | ||
10._________________ $______________ | ||
11._________________ $______________ | ||
12. TOTAL PURCHASES\ Cost of Sales | $________________ | $________________ |
==================================== | ||
GROSS PROFIT | $________________ | $________________ |
==================================== | ||
DEDUCT EXPENSES | ||
13._________________________________ | $________________ | $________________ |
14._________________________________ | $________________ | $________________ |
15._________________________________ | $________________ | $________________ |
16._________________________________ | $________________ | $________________ |
17._________________________________ | $________________ | $________________ |
18._________________________________ | $________________ | $________________ |
19._________________________________ | $________________ | $________________ |
20._________________________________ | $________________ | $________________ |
21._________________________________ | $________________ | $________________ |
22._________________________________ | $________________ | $________________ |
23._________________________________ | $________________ | $________________ |
24._________________________________ | $________________ | $________________ |
25._________________________________ | $________________ | $________________ |
___________________________________ | $________________ | $________________ |
___________________________________ | $________________ | $________________ |
___________________________________ | $________________ | $________________ |
TOTAL EXPENSES | ||
=================================== | $________________ | $________________ |
NET PROFIT | $________________ | $________________ |
=================================== |
Sam's Computer Store | Jill & John Pilgry | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
544 W. 5th St. | |||||||||||||||||||||||||||
Mayville, WI | Expenses | ||||||||||||||||||||||||||
May-00 | |||||||||||||||||||||||||||
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ||||||||||||||||
Date | Name | Check # | Check Amt | Cost of Sales | Office Sup. | Wages | Rent | Telephone | Utilities | Advertizing | Vehicle | Taxes | Insurance | Maintenance | Misc Expenses | ||||||||||||
YTD Totals | $ | 92,499.32 | $ | 495.75 | $ | 11,348.00 | $ | 3,180.00 | $ | 720.00 | $ | 1,549.96 | $ | 7,990.60 | $ | 576.50 | $ | 7,157.80 | $ | 258.75 | $ | 1,728.97 | $ | 1,556.38 | |||
7-MayBill Wagner | 15492 $ | 280.00 | $ | 280.00 | |||||||||||||||||||||||
7-MayTom Jason | 15493 $ | 350.00 | $ | 350.00 | |||||||||||||||||||||||
10-MayRace Office Supply | 15494 $ | 146.31 | $ | 146.31 | |||||||||||||||||||||||
10-MayIRS | 15495 $ | 1,146.81 | $ | 1,146.81 | |||||||||||||||||||||||
10-MayHowie's Service | 15496 $ | 19.00 | $ | 19.00 | |||||||||||||||||||||||
11-MayThomas Electronics | 15498 $ | 7,948.00 | $ | 7,948.00 | |||||||||||||||||||||||
11-MayWPS | 15497 $ | 450.00 | 450.00 | ||||||||||||||||||||||||
11-MayWisconsin Tele | 15499 $ | 179.40 | $ | 179.40 | |||||||||||||||||||||||
12-MayWNAM | 15500 $ | 491.00 | $ | 491.00 | |||||||||||||||||||||||
12-MaySun Inc. | 15501 $ | 1,346.57 | $ | 1,346.57 | |||||||||||||||||||||||
14-MayTom Jason | 15502 $ | 350.00 | $ | 350.00 | |||||||||||||||||||||||
14-MayBill Wagner | 15503 $ | 280.00 | $ | 280.00 | |||||||||||||||||||||||
14-MayPost Crescent | 15504 $ | 752.76 | $ | 752.76 | |||||||||||||||||||||||
14-MayBenic Computers | 15505 $ | 6,349.00 | $ | 6,349.00 | |||||||||||||||||||||||
17-MayService Master | 15506 $ | 192.00 | $ | 192.00 | |||||||||||||||||||||||
17-MayPolice Ball | 15507 $ | 45.00 | $ | 45.00 | |||||||||||||||||||||||
18-MayThomas Electronics | 15508 $ | 4,689.00 | $ | 4,689.00 | |||||||||||||||||||||||
19-MayWYTL/WOSH | 15509 $ | 540.00 | $ | 540.00 | |||||||||||||||||||||||
19-MayHomarc Inc | 15510 $ | 795.00 | $ | 795.00 | |||||||||||||||||||||||
21-MayTom Jason | 15511 $ | 350.00 | $ | 350.00 | |||||||||||||||||||||||
21-MayBill Wagner | 15512 $ | 280.00 | $ | 280.00 | |||||||||||||||||||||||
22-MayHowie's Service | 15513 $ | 45.00 | $ | 45.00 | |||||||||||||||||||||||
23-MayOshkosh Northwestern | 15514 $ | 350.00 | $ | 350.00 | |||||||||||||||||||||||
24-MayBenic Computers | 15515 $ | 3,568.00 | $ | 3,568.00 | |||||||||||||||||||||||
24-MayINA | 15516 $ | 175.00 | $ | 175.00 | |||||||||||||||||||||||
25-MayWis.Public Service Corp | 15517 $ | 374.32 | $ | 374.32 | |||||||||||||||||||||||
26-MayUnited Fund | 15518 $ | 150.00 | $ | 150.00 | |||||||||||||||||||||||
26-MaySun Inc. | 15519 $ | 592.56 | $ | 592.56 | |||||||||||||||||||||||
27-MayChamber Com. (Dues) | 15520 $ | 230.00 | $ | 230.00 | |||||||||||||||||||||||
28-MayTom Jason | 15521 $ | 350.00 | $ | 350.00 | |||||||||||||||||||||||
28-MayBill Wagner | 15522 $ | 280.00 | $ | 280.00 | |||||||||||||||||||||||
28-MayHowie's Service | 15523 $ | 37.50 | $ | 37.50 | |||||||||||||||||||||||
28-MayService Master | 15524 $ | 211.00 | $ | 211.00 | |||||||||||||||||||||||
31-MayWis. Dept. Revenue | 15525 $ | 697.41 | $ | 697.41 | |||||||||||||||||||||||
31-MayRace Office Supply | 15526 $ | 28.56 | $ | 28.56 | |||||||||||||||||||||||
| $34,069.20 | $ | 24,493.13 | $ | 174.87 | $ | 2,520.00 | $ | 795.00 | $ | 179.40 | $ | 374.32 | $ | 2,133.76 | $ | 101.50 | $ | 1,844.22 | $ | 625.00 | $ | 403.00 | $ | 425.00 | ||
| $ | 116,992.45 | $ | 670.62 | $ | 13,868.00 | $ | 3,975.00 | $ | 899.40 | $ | 1,924.28 | $ | 10,124.36 | $ | 678.00 | $ | 9,002.02 | $ | 883.75 | $ | 2,131.97 | $ | 1,981.38 |
Sam's Computer Store | Jill & John Pilgry | |||||||||||||||||
May-00 | SALES | |||||||||||||||||
3 | 4 | 5 | 6 | 7 | 8 | |||||||||||||
Computer | Software | Books | Peripherals | Training | Misc | Daily Totals | Weekly Totals | |||||||||||
YTD Totals | $ 78,329.68 | $ | 26,096.44 | $ | 2,741.72 | $ | 23,937.48 | $ | 750.56 | $ | 28.00 | |||||||
Date | ||||||||||||||||||
2-May | $ | 567.52 | $ | 156.99 | $ | 36.42 | $ | 399.95 | $ | 80.00 | $ | - | $ | 1,240.88 | ||||
3-May | $ | 764.98 | $ | 210.87 | $ | 15.75 | $ | 196.50 | $ | - | $ | 5.00 | $ | 1,193.10 | ||||
4-May | $ | 871.32 | $ | 184.63 | $ | 75.30 | $ | 245.30 | $ | 10.00 | $ | - | $ | 1,386.55 | ||||
5-May | $ | 671.36 | $ | 220.42 | $ | 53.20 | $ | 288.40 | $ | 30.00 | $ | - | $ | 1,263.38 | ||||
6-May | $ | 794.53 | $ | 350.72 | $ | 21.10 | $ | 149.36 | $ | - | $ | - | $ | 1,315.71 | ||||
7-May | $ | 943.31 | $ | 424.65 | $ | - | $ | 836.75 | $ | - | $ | - | $ | 2,204.71 | $ | 8,604.33 | ||
9-May | $ | 475.41 | $ | 198.64 | $ | 26.00 | $ | 330.40 | $ | 40.00 | $ | - | $ | 1,070.45 | ||||
10-May | $ | 631.25 | $ | 75.00 | $ | - | $ | - | $ | - | $ | 10.00 | $ | 716.25 | ||||
11-May | $ | 241.63 | $ | 156.38 | $ | 33.40 | $ | 440.00 | $ | - | $ | - | $ | 871.41 | ||||
12-May | $ | 714.62 | $ | 348.62 | $ | 25.00 | $ | 75.36 | $ | 20.00 | $ | - | $ | 1,183.60 | ||||
13-May | $ | 691.75 | $ | 75.84 | $ | 19.50 | $ | 590.00 | $ | - | $ | - | $ | 1,377.09 | ||||
14-May | $ | 541.28 | $ | 140.50 | $ | - | $ | - | $ | - | $ | 4.00 | $ | 685.78 | $ | 5,904.58 | ||
16-May | $ | 364.18 | $ | 230.75 | $ | 41.90 | $ | - | $ | - | $ | - | $ | 636.83 | ||||
17-May | $ | 894.36 | $ | 246.40 | $ | 36.52 | $ | - | $ | - | $ | - | $ | 1,177.28 | ||||
18-May | $ | 1,643.80 | $ | 643.74 | $ | 147.80 | $ | 876.51 | $ | - | $ | 6.00 | $ | 3,317.85 | ||||
19-May | $ | 284.67 | $ | - | $ | - | $ | 321.54 | $ | - | $ | - | $ | 606.21 | ||||
20-May | $ | 591.84 | $ | 280.30 | $ | 17.50 | $ | 543.41 | $ | 30.00 | $ | - | $ | 1,463.05 | ||||
21-May | $ | 756.31 | $ | 150.30 | $ | 42.30 | $ | 678.95 | $ | 20.00 | $ | 4.00 | $ | 1,651.86 | $ | 8,853.08 | ||
23-May | $ | 594.51 | $ | 250.90 | $ | 56.75 | $ | 136.50 | $ | - | $ | - | $ | 1,038.66 | ||||
24-May | $ | 964.35 | $ | 442.53 | $ | 31.42 | $ | - | $ | - | $ | 2.00 | $ | 1,440.30 | ||||
25-May | $ | 736.49 | $ | 211.34 | $ | 25.97 | $ | 71.00 | $ | - | $ | 3.00 | $ | 1,047.80 | ||||
26-May | $ | 3,497.86 | $ | 1,468.39 | $ | 43.00 | $ | - | $ | - | $ | - | $ | 5,009.25 | ||||
27-May | $ | 284.69 | $ | - | $ | 15.00 | $ | 245.00 | $ | - | $ | - | $ | 544.69 | ||||
28-May | $ | 1,384.76 | $ | 546.97 | $ | 13.00 | $ | - | $ | - | $ | - | $ | 1,944.73 | $ | 11,025.43 | ||
30-May | $ | 796.58 | $ | 231.42 | $ | - | $ | 438.41 | $ | 40.00 | $ | - | $ | 1,506.41 | ||||
31-May | $ | 384.60 | $ | 119.75 | $ | 30.00 | $ | 120.70 | $ | 10.00 | $ | - | $ | 665.05 | $ | 2,171.46 | ||
========= | ========= | ========= | ========= | ========= | ========= | |||||||||||||
| $ | 21,087.96 | $ | 7,366.05 | $ | 806.83 | $ | 6,984.04 | $ | 280.00 | $ | 34.00 | $ | 36,558.88 | ||||
========= | ========= | ========= | ========= | ========= | ========= | |||||||||||||
| $ | 99,417.64 | $ | 33,462.49 | $ | 3,548.55 | $ | 30,921.52 | $ | 1,030.56 | $ | 62.00 | $ | 168,442.76 |
The accountant requested that the program include the following features:
That all of the calculations should be carried out by his computer.
That the sums for each client should be stored to be used from month to month but that the program would have a way to modify these sums if it became necessary later.
That a column for percentages be added to the general ledger so that he could compare sales, purchases (cost of sales), and that the program would calculate each expense category as a percentage of gross sales for MTD and YTD.
That he would be able to enter in the expenses and sales into the program as he read from the client's checkbook and the cash register slips, he would be able to edit errors or delete records which were incorrect, he would be able to get a print out of the expenses and sales for MTD, and that these could be cleared after each month. (The monthly values would be cleared only on demand by him and not automatically done by the computer.)
That the computer would sort the expenses and sales into their respective categories and print their sums in the P&L statement.
That he could override the Total Sales and the Total Purchases if he wished. He claimed that this was necessary to adjust the monthly profit/loss statements to reflect the "true business" when sales or purchases would require carrying over several months.
That all of his thirteen expense categories could be used and in addition four others could be entered for special clients. Further he wanted room for three expense categories to be listed in the remarks area which were not figured into the Total Expenses.
The Main Menu of the program was to look like the following:
The Sales Ledger menu was to look like the following:
The following steps were part of the Design Phase:
Abstract Data Types for Accounting
Human Interface for Accounting
Structure Chart for Accounting
Flow Chart for Accounting
Pseudo Code for Accounting
The above examples of the design phase's documents are incomplete and are listed here to only give you a brief illustration of where you will be by the end of this course.
Company:
What types of data are needed for Company?
name - string
owner - string
address - string
city - string
state - string
zip - string
What types of functions/methods are needed for Company?
input name, owner, address, city, state and zip
output company information
UML data type description:
Company |
---|
-companyName:string |
-companyOwner:string |
-companyAddress :string |
-companyCity:string |
-companyState:string |
-companyZip:string |
+inputName(name: string) |
+inputOwner(owner: string) |
+inputAddress(address: string) |
+inputCity(city: string) |
+inputState(state: string) |
+inputZip(zip: string) |
+outputCompanyInfo( ) |
Date:
What types of data for Date?
month - int
day - int
year - int
What types of functions/methods for Date?
input month,
input day
input year
output month
output day
output year
output date
UML data type description:
Date |
---|
-month:integer |
-day:integer |
-year:integer |
+inputMonth(theMonth: int) |
+inputDay(theDay: int) |
+inputYear(theYear: int) |
+outputMonth( ):integer |
+outputDay( ):integer |
+outputYear( ):integer |
+outputDate( ) |
Sales:
What types of data for Sales?
day - date
daily_sales[5] - array of floats
What types of functions for Sales?
input date (month, day and year)
input sales
modify sales
output sales date
output sales amount for a particular account
output sales for the date
UML data type description:
Sales:Date |
---|
-dailySales[5]:float |
+inputSalesAmounts(dayNumber: int, amount: float) |
+modifySalesAmount(dayNumber: int, amount: float) |
+showSalesAmount(number:integer):float |
+showSalesAmounts( ) |
The above listing is not a complete analysis, so ask yourself:
What other ADTs would be needed?
The Design Phase as well as the Specification Phase should contain samples of the Human Interface. For example there should be samples of the menus.
The menus of the system should look something like the following:
Main Menu
Start New Client
Expense Ledger Menu
Sales Ledger Menu
Profit and Loss Menu
End of Year Processing
Quit
Which?
Sales Ledger Menu
Enter Daily Sales
Edit Daily Sales
Print Daily Sales
Process End of Month Sales
Return to Main Menu
Which?
Expense Ledger Menu
Enter Expense
Edit Expense
Print Expense Report
Process End of Month Expenses
Return to Main Menu
Which?
In addition to the menus as shown above, there should also be samples of any additional input screens to provide the programmer with information about how they are to appear. For example input screens need to provide information as to how the sales and expenses would be entered and what the screens will look like when the user wants to edit the sales or the expenses.
But not only should there be examples of the input screens, there needs to be examples of output screens as well. For example there needs to be examples of what each report will look like.
The samples for both the input and the output will be similar to yet different from the samples created for the Specification Phase. The documents of the Specification Phase should be samples of what the user is currently viewing and how it will be different. The Design Phase samples should show the programmer how to represent the screens that the user will view in the finished program.
As discussed previously, a program needs to be subdivided into pieces that are called modules. Subdividing the program in this way provides a better design, one which is easier to manage and in general one that is less expensive to create and to maintain.
The structure chart of the accounting program should look similar to the following:
Notice at the top of this structure chart is the main module called accounting. This module is then subdivided into the several additional modules that appeared in the main menu seen previously to include the options: Start Client, Sales Ledger, Expense Ledger, Profit and Loss and End of Year Processing. The Sales Ledger and the Expense Ledger menus each had several options. For example in the Sales Ledger menu, there were Enter Sales, Edit Sales, Print Sales and Process End of Month options. Notice in this structure chart that each of these options has a module that is to carry out these objectives.
What this sample of a structure chart does not show is the movement of data between the different modules. The reason for this is that this program was created in the early 80's and the movement of data was not directly between the different modules but instead the data was handled globally. Later in the notes will be samples of structure charts that show how to handle the movement of data directly between modules rather than moving data globally.
The Design Phase should provide documentation that shows the programmer the logic of the program and the names of the modules as well as the names of the data that are to be used in the program. There are several different tools that can be used to do this. One tool is a flowchart. A flowchart is a graphic representation of this logic. It shows the program flow.
The following is a flowchart for the Accounting module and it shows the logic of the main menu. Notice as the program begins, the user decides which process to select and depending on the choice will go to one of the modules for that menu option. After each module is completed, the program flow returns to the main menu.
This flowchart is not a complete flowchart of the total system and its individual parts/modules. The final documentation should contain a separate flowchart for each module.
The Design Phase should contain documents that represent the logic of the program. This can be done with a flowchart or with pseudo code. The pseudo code is "false" code. That is, it does not show exactly the instructions in a particular language. In fact pseudo code should be written so that it could be used in one of several different languages depending on what language is available for the program. What the pseudo code should do is to show the logic of the program but do it in words rather than graphically as is done with a flowchart.
This example could represent the pseudo code of the accounting program:
Accounting do Display the Main Menu Choices 1. Start New Client 2. Expense Ledger Menu 3. Sales Ledger Menu 4. Profit and Loss Menu 5. End of Year Processing 6. Quit Request and Receive Choice Case: 1: Process startClient 2: Process expenseLedger 3: Process salesLedger 4: Process pAndl 5: Process endOfYear 6: End Program EndCase dowhile(continue) End startClient ..... Return expenseLedger ..... Return salesLedger ..... Return pAndl ...... Return .....
Notice that the main module processes or calls each of the sub modules depending on the user's choice.
When creating pseudo code, each module has its own separate part of the total. When each module completes its instructions, the program will return to the calling module. That is the reason for the word Return in each of the sub modules of the pseudo code.
In this example, the dots above represent statements that are being left out. The real pseudo code would provide these statements.
The Coding Phase converts the documents of the previous phases into the instructions of a particular version of a particular language. In this course we will look at using the version of C# in Visual Studio .NET 2005.
Note: The original accounting program was written in the early 80's in BASIC before C# was invented. The coding listed here is actually a maintenance of the original program that has been rewritten in C++.
Link to each of the following to get a general feel of how the design would be converted to C++.
Header file: accounting.h
Program file: accounting.cpp
This implementation of the program is in two pieces one of which is called a header file and the other is called a program file. A later lecture will discuss how to combine these two files into a program using the Visual Studio .NET C# CASE tools.
// This is the header: accounting.h // // This header is required for the program accounting.cpp // It does not include all of the class information required // by the program. // // // // Some of the classes that are needed in this program. // class company { private: string companyName, companyOwner, companyAddress, companyCity, companyState, companyZip; public: void inputName() { cout << "What is the company name? "; cin >> companyName; cout << endl; } string outputName() { return companyName; } void inputOwner() { cout << "Who is the company's owner? "; cin >> companyOwner; cout << endl; } void inputAddress() { cout << "What is the company's address? "; cin >> companyAddress; cout << endl; } void inputCity() { cout << "What is the company's City? "; cin >> companyCity; cout << endl; } void inputState() { cout << "What is the company's State? "; cin >> companyState; cout << endl; } void inputZip() { cout << "What is the company's Zip? "; cin >> companyZip; cout << endl; } void outputCompanyInfo() { cout << "Company: " << companyName << endl << "Owner: " << companyOwner << endl << "Address: " << companyAddress << endl << "City: " << companyCity << endl << "State: " << companyState << endl << "Zip: " << companyZip << endl; } }; class date { private: int month, day, year; public: void inputMonth() { cout << "What is the month? "; cin >> month; cout << endl; } void inputDay() { cout << "What is the day? "; cin >> day; cout << endl; } void inputYear() { cout << "What is the year? "; cin >> year; cout << endl; } int outputMonth() { return month; } int outputDay() { return day; } int outputYear() { return year; } void outputDate() { cout << month <<'/' << day << '/' << year; } }; class sales: public date { private: float dailySales[5]; public: void inputSalesAmounts() { for(int gl = 3; gl<=7;++gl) { char resp, ch; do { cout << endl <<"What is the sales for GL # " << gl << "? "; cin >> dailySales[gl-3]; cout << endl << "Correct? (Y/N) "; resp=' '; cin.get(ch).get(resp).get(); }while((resp!='Y') && (resp!='y')); } } void modifySalesAmount(int number) { cout << "The current value for that gl account is: " << dailySales[number] << endl; cout << "What should the amount be? "; cin >> dailySales[number]; cout << endl; } void showSalesAmounts() { float ttl_sales=0.00; for(int gl = 3; gl<=7;++gl) { cout << endl << "Sales GL #" << gl << ": " << setprecision(2) << setw(10) << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << dailySales[gl-3]; ttl_sales += daily_sales[gl-3]; } cout << endl << setw(23) << "----------"; cout << endl << "Totals Sales " << setprecision(2) << setw(10) << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << ttl_sales; } float showSalesAmount(int number) { return dailySales[number]; } }; // program-id ACCOUNTING.CPP // author DON VOILS // date written SEPTEMBER 21, 1988 // modified by dlv // date(s) modified 12/1/93; 8/23/00; 8/23/01 // hardware requirements PC // 512 K RAM // 10 MB HARDDISK // software requirements PC DOS 2.1 or higher // MICROSOFT C++ Version 6.0 or higher // // program description THIS PROGRAM CONTAINS THE MENUS // FOR ALL MODULES OF THE ACCOUNTING // SYSTEM. FROM THESE MENUS THE USER // CAN SELECT WHICH OF THE ACCOUNTING // MODULES HE/SHE WANTS TO USE. // // Program was modified to be compliant with Standard C++. // // /* The following are the headers required for this program. The names have been modified to be compliant with Standard C++. */ #include<conio.h> #include<iostream> #include<fstream> #include<iomanip> #include<string> /* The following was added to become compliant with Standard C++. */ using namespace std; /* The following header contains the data structures definition. */ #include"accounting.h" // // FUNCTION PROTOTYPES // void clr_scrn(); void salesLedger(); void inputSales(); void printSales(); void editSales(); void eomSales(); void startClient(); // // Start of the program. // void main() { char menu_1='0', ch; /* Main menu to select major processes to perform. */ do { menu_1='0'; clr_scrn(); cout << " Main Menu" << endl << endl << endl << " 1. Start New Client" << endl << endl << " 2. Expense Ledger Menu" << endl << endl << " 3. Sales Ledger Menu" << endl << endl << " 4. Print P&L" << endl << endl << " 5. End of Year Processing" << endl << endl << " 6. Exit" << endl << endl << " Which? "; cin.get(menu_1).get(ch); clr_scrn(); switch (menu_1) { case '1': // THIS MODULE PROCESSES THE INSTALLATION // OF NEW CLIENTS. // // startClient(); // menu_1 = '0'; break; case '2': // THIS MODULE HELPS THE USER TO SELECT WHICH // OF THE EXPENSE MODULES TO USE. // // // expenseLedger(); // menu_1 = '0'; break; case '3': // THIS MODULE HELPS THE USER TO SELECT WHICH // OF THE SALES MODULES TO USE. // // salesLedger(); // menu_1 = '0'; break; case '4': // THIS MODULE PERMITS THE USER TO PROCESS // THE P & L STATEMENT BY MERGING THE MTD // FIGURES WITH THE YTD FIGURES. IF THE // USER CHOOSES, THE MTD MAY BE ADDED TO // THE YTD FIGURES FOR STORAGE FOR THE // NEXT MONTH. // // PandL(); // menu_1 = '0'; break; case '5': // THIS MODULE PERMITS THE ZEROING OF YTD // FIGURES SO THAT A NEW YEAR CAN BE PROCESSED. // // endofYear(); // menu_1 = '0'; break; case '6': // THIS SECTION PERMITS THE USER TO EXIT // menu_1 = '6'; break; default: // IN CASE THE USER SELECTED A NUMBER OTHER // THAN 1-5 THIS MODULE WILL FORCE THE USER // TO CHOOSE AN ACCEPTABLE NUMBER. // menu_1 = '0'; break; } } while (menu_1=='0'); } /* program-id salesLedger() author DON VOILS date written SEPTEMBER 21, 1988 modified by dlv date(s) modified 8/23/01 program description THIS FUNCTION CONTAINS THE MENU FOR THE SALES. */ void salesLedger() { char menu_3='0'; /* THIS MODULE HELPS THE USER TO SELECT WHICH OF THE SALES MODULES TO USE. */ do { menu_3='0'; clr_scrn(); cout << flush; cout << " Sales Ledger Menu" << endl << endl << " 1. Enter Sales" << endl << endl << " 2. Change Sales" << endl << endl << " 3. Print Sales" << endl << endl << " 4. End of Month Processing for Sales" << endl << endl << " 5. Return to Main Menu" << endl << endl << " Which? "; cin.get(menu_3).get(); switch (menu_3) { case '1': /* THIS MODULE PERMITS THE USER TO ENTER MTD SALES TRANSACTIONS. */ inputSales(); menu_3 = '0'; break; case '2': /* THIS MODULE PERMITS THE USER TO EDIT MTD SALES TRANSACTIONS. */ editSales(); menu_3 = '0'; break; case '3': /* THIS MODULE PERMITS THE USER TO PRINT MTD SALES. */ printSales(); menu_3 = '0'; break; case '4': /* THIS MODULE PERMITS THE USER TO ZERO MTD TRANSACTIONS SO THAT A NEW MONTH CAN BE PROCESSED. */ eomSales(); menu_3 = '0'; break; case '5': /* THIS MODULE PERMITS THE USER TO GO BACK TO THE MAIN MENU. */ menu_3 = '5'; break; default: /* IN CASE THE USER ENTERED A SELECTION OTHER THAN 1-5 THIS MODULE WILL FORCE THE USER TO MAKE THE CHOICE AGAIN. */ menu_3 = '0'; break; } } while (menu_3 == '0'); } // program_id inputSales() // author don voils // date written 11/25/93 // modified by dlv // date(s) modified 8/23/00 // program description This function inputs the daily sales. // void inputSales() { char resp=' '; clr_scrn(); sales today; ofstream outfile; outfile.open("SALES.DAT",ios::app | ios::binary); do { clr_scrn(); today.inputDay(); today.inputMonth(); today.inputYear(); today.inputSalesAmounts(); outfile.write((char *) &today, sizeof(today)); clr_scrn(); cout << "Enter another day? (Y/N) "; resp=' '; cin.get(resp).get(); }while(resp=='Y' || resp=='y'); outfile.close(); } // program_id printSales() // author don voils // date written 11/25/93 // modified by dlv // date(s) modified 8/23/01 // program description This function inputs from file // the daily sales and sends them to a // printer. // void printSales() { char resp=' ', ch; int count; clr_scrn(); ifstream companyFile; companyFile.open("COMPANY.DAT"); company theCompany; companyFile.read((char&)theCompany,sizeof(theCompany)); companyFile.close(); string name = theCompany.outputName(); sales today; clr_scrn(); ifstream infile; infile.open("SALES.DAT",ios::in | ios::binary); if (!infile) { cout << "The SALES.DAT is having problems."; return; } ofstream prtfile; /* The following will need to be modified for system installed on. */ prtfile.open("LPT1"); if (!prtfile) { cout << "The printer is having problems."; return; } float gl_ttls[5]={0.00}; for(count=1;count<=(60 -strlen(name))/2;++count) prtfile.put(' '); prtfile << name << endl; prtfile << setw(40) << "Monthly Sales Ledger" << endl; prtfile.width(60); prtfile.fill('-'); prtfile << endl; prtfile.fill(' '); prtfile << setw(6) << "Date"; for(count=3;count <=7;++count) prtfile << setw(9) << "GL#" << count; prtfile << endl; infile.read((char *) &today, sizeof(today)); while(infile) { prtfile.width(2); prtfile.fill('0'); prtfile<< today.showMonth(); prtfile.width(1); prtfile << "/"; prtfile.width(2); prtfile.fill('0'); prtfile << today.showDay(); prtfile.width(1); prtfile << "/"; prtfile.width(2); prtfile.fill('0'); prtfile << today.showYear(); prtfile.fill(' '); for(count=3;count <=7;++count) { prtfile << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setprecision(2) << setw(10) << today.showSalesAmount(count-3); gl_ttls[count-3] += today.showSalesAmount(count-3); } prtfile << endl; infile.read((char *) &today, sizeof(today)); } prtfile << setw(8) << " "; for(count=3;count <=7;++count) prtfile << setw(10) << "---------"; prtfile << endl << setw(8) << " "; for(count=3;count <=7;++count) prtfile << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setprecision(2) << setw(10) << gl_ttls[count-3]; prtfile << flush; cout << endl << endl << "Are you ready to end this? (Y/N)"; cin.get(resp).get(ch); } // program_id editSales() // author don voils // date written 11/25/93 // modified by dlv // date(s) modified 8/23/01 // program description This function permits editing of // the daily sales. // void editSales() { char resp=' ', ch; clr_scrn(); sales today; fstream file; int record_number; int position; file.open("SALES.DAT",ios::in | ios::out | ios::binary); file.seekg(0,ios::end); int end_position = file.tellg(); int last_record = end_position/sizeof(sales); cout << "The length of the files is " << end_position << " bytes" << endl << "The size of each record is " << sizeof(sales) << " bytes" << endl << "The number of records is " << last_record << endl; if (last_record==0) { cout << "There are no records. The program is now exiting." << endl << endl << "Continue? (Y/N) "; cin.get(resp).get(); return; } do { do { cout << endl << "Which record do you want to see? "; cin >> record_number; if ((record_number>last_record) || (record_number<1)) cout << endl << endl << "Beyond end of data." << " Pick another record." << endl; }while((record_number>last_record) || (record_number<1)); clr_scrn(); position = (record_number-1)*sizeof(sales); file.seekg(position); file.read((char*) &today,sizeof(sales)); cout << "Sales at record number " << record_number << " is " << endl; cout << "Date: " << today.outputMonth() << "/" << today.outputDay() << "/" << today.outputYear() << endl << endl; today.showSalesAmounts(); cout << endl << endl << "Edit this record? (Y/N) "; cin.get(ch).get(resp).get(); cout << endl; if ((resp=='y') || (resp=='Y')) { today.inputMonth(); today.inputDay(); today.inputYear(); today.inputSalesAmounts(); file.seekp(position); file.write((char *) &today, sizeof(today)); } cout << endl << endl << "Do you want to edit another record? (Y/N) "; cin.get(resp).get(); clr_scrn(); } while(resp=='Y' || resp=='y'); } // program_id eomSales() // author don voils // date written 11/27/93 // modified by dlv // date(s) modified 8/23/01 // program description This function removes the // sales file from the disk // at the end of the month. // void eomSales() { char resp=' '; clr_scrn(); cout << "Clear the sales data for end of month processing? (Y/N) "; cin.get(resp).get(); if(resp=='Y' || resp=='y') { resp = ' '; cout << endl << endl << "Are you sure? (Y/N)"; cin.get(resp).get(); if(resp=='Y' || resp=='y') { cout << "I am erasing the file." << endl; fstream file; file.open("SALES.DAT",ios::out | ios::trunc | ios::binary); } } } // program_id startClient() // author don voils // date written 11/27/93 // // program description This function starts a new client // void startClient() { int count; clr_scrn(); ofstream the_company; the_company.open("COMPANY.DAT",ios::out|ios::binary); company theCompany; clr_scrn(); char word[80]; for(count = 0; count <=5;++count) switch(count) { case 0: theCompany.inputName(); break; case 1: cout << "What is the company name? "; cin.getline(word,80); cout << endl << endl; theCompany.inputOwner(); break; case 2: theCompany.inputAddress(); break; case 3: theCompany.inputCity(); break; case 4: theCompany.inputState(); break; case 5: theCompany.inputZip(); break; } /* A module to enter YTD totals needs to be inserted at this point. */ write((char *) &theCompany, sizeof(theCompany)); } // program_id clr_scrn() // author don voils // date written 11/27/93 // // program description This function clears the screen for // those compilers which do no have // such a function built in. // void clr_scrn() { for(int loop_counter=0;loop_counter<=25;++loop_counter) cout << endl; }
After the coding phase, a system of testing needs to be set up in the testing phase. This is usually done by the testing staff which might be called: Quality Assurance. For this group, the following questions need to be addressed:
What are the general techniques of the company used for testing?
Using these techniques, what would be a good plan for testing of this program?
How should the program be tested for Validation, Verification, Unit Testing, Integration Testing, Systems Testing, Blackbox Testing and Whitebox Testing?
Where are the specification documents, the design documents and the coding documents?
Do the documents of the various phases agree?
Where should the sample data come from and what should it look like?
Is there going to be Beta Testing in addition to Alpha Testing and if so who and when will these individuals be involved?
Note: What is being recommended today is that the testing of the program should begin with the first phase and then continue to a more intense testing in the Testing Phase.
Most programs require some modification after they have been put into service. That is why each programming project has a maintenance phase.
To implement this phase, a system of maintenance needs to be set up and the following questions need to be addressed:
What would be a good plan for this phase?
What type of modifications can be anticipated?
Did management hurry this product to market so that not all of the features were implemented or tested that will require maintenance?
One thing to keep in mind is that this phase can be a very costly phase. For a private consultant, this can also be an area of additional repvenue.
After the accounting program described in this example was set up for the accountant and was in place for some time, he began to see places where modifications should be made to improve the quality of his services. Therefore a maintenance phase started the 5-phases of software development all over again.