Program Design - Example 3


Specification:

Suppose you work for the City of Boca Raton, FL in the IT department. You have been requested to write a program that prints a report to the screen that lists the value of a property and the amount of the annual City property tax on that property. The table begins with the property value of $1,000.

The input is to be from the keyboard and includes:

  • the maximum value of the property to be listed in the table

  • the annual property tax rate (it is the same for all properties regardless of the property's value.)

The output shall be:

  • a heading that includes a line with the city's name, a heading line with the page number on it, a heading line with column headers and the heading is to be printed every 52 lines of the report (counting the three heading lines).

  • a detail line that includes the property value and the tax on that property so that each consecutive line adds $100 to the value of the previous line.

Create a sample input and a sample output screen. Create some values for hand testing to be used during the Design, the Coding and the Testing Phase.

Design:

Before you look at the examples, try to create each of the design parts on your own.

  • The structure chart is: tax_sc (Notice that in this example that Process Heading as a substructure of the Process Detail Line since the heading is to be printed on each page rather than just once. Notice the data flow line.)

  • The pseudo code is tax_pc. (How was the data flow line handled in the pseudo code?)

Coding:

Before you look at the example, try to create the C++ program on your own.

  • The C++ program is taxes_cpp.

Testing:

Copy the program above into your compiler, compile and run it. Use the test values that were created in the Specification Phase to determine if the program is working correctly.

Maintenance:

What type of modifications would you anticipate?

Compare the structure chart and the pseudo code from the examples above with the C++ program. Were there any differences? If so, what differences were there? Notice the use of global variables. How would you eliminate the use of the global variables? Were there any variables passed from one module to another? Is it better to use global variables or not? Why? Rewrite the C++ program without using global variables.




Intermediate Business Programming with C++
Intermediate Business Programming with C++
ISBN: 738453099
EAN: N/A
Year: 2007
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net