Page #127 (Removing Installed Controls)

 

Keeping Track (KT) is a suite of seven executables gathered under the umbrella of the KTEntryPoint program and located in your Projects\ KT Source Code directory. They were originally written to demonstrate the inner workings of the common C# statements found in the Visual C# compiler. The Entry Point window looks like this:

This suite was designed for those who invest in stocks, bonds , and mutual funds as part of their financial portfolio. The names of the stocks/bonds/funds are entered by the user in the program KTStartup, and a persistent file is created for each item to record the activity of the item on a weekly basis. The list of portfolio items is recorded in a file named Masterfile.dta, and KT uses this list to cycle through the items every time the weekly data is posted (in the same order that they are listed in Masterfile).

Whenever an item is purchased or sold, that purchase/sale is recorded in KTBuy_Sold (see the Buy or Sold Declarations button in Figure A-1).

image from book
Figure A-1: Keeping Track Entry Point window

The user is encouraged to enter the KTWeeklyDataPosting program regularly (once a week is the optimum posting interval), and record the prevailing prices of the items in the stocks/bonds/funds portfolio (as reported on the Internet and in newspapers). The program works equally well whether the postings occur every week, once a month, or at random points during the year.

The purpose of this data posting is to prepare material for the next logical operation in the sequence: Calculate Net Worth. Calculate Net Worth is activated as soon as the user has completed the weekly data posting; it produces a hardcopy listing of the value of all portfolio items. The total at the bottom of the sheet is the user s portfolio current net worth.

From time to time the user may elect to enter the Print or Plot Historical Data program and print out or display a plot of the collective data in his portfolio. The types of collective data available for prints/plots/displays is shown in Figure A-2.

image from book
Figure A-2: Print/Plot Historical Files window

A typical KT plot is shown in Figure A-3. The X axis is the week of the year, and the Y axis is dollars. The vertical green line is the separator between 2002 and 2003.

image from book
Figure A-3: KT Net Worth plot

There are also two file maintenance programs on the KT Entry Point window: KTRealphabetize and CopyToFloppy. KTRealphabetize realphabetizes Masterfile.dta, and CopyToFloppy copies all the data files to a floppy disk for safekeeping. The data files for one given portfolio item (such as IBM) are created with a calendar year, so the year 2005 data for IBM would be found in the IBM__2003.ddt file. This way, new data files can be created once a year to keep the data files from becoming too verbose (and last year s data can be retained on one floppy disk).

Open table as spreadsheet

Item

KT Task

Program Executed

1.

Enter portfolio items names into Masterfile.

KTStartup

2.

Enter items purchased and total price of purchase.

KTBuy_Sold

3.

Enter items sold and total sale price.

KTBuy_Sold

4.

Post prices of all portfolio items, weekly or at random.

KTWeeklyDataPosting

4b.

Determine current net worth, based on latest data posting.

KTWeeklyDataPosting

5.

Print/plot/display historical, multiweek data:

  1. Print list of weekly net worth data since KT inception.

  2. Plot weekly net worth data (maximum of 52 weeks).

  3. Plot weekly net worth net gain/loss (max of 52 weeks).

  4. Print a *.ddt file (for example, IBM__2005.ddt) since KT inception.

  5. Display a *.ddt file, since KT inception.

  6. Plot a *.ddt file, since KT inception.

KTPlotter

6.

Realphabetize file Masterfile.dta.

KTRealphabetize

7.

Copy all data files to a floppy disk.

CopyToFloppy

The source code for these programs is contained in the App C --KTVC#TaggedCode.doc file. The listing is provided in Word so the programmer can search for any executable statements, etc., in the listing without having to search the listing visually.

 


Unlocking Microsoft C# V 2.0 Programming Secrets
Unlocking Microsoft C# V 2.0 Programming Secrets (Wordware Applications Library)
ISBN: 1556220979
EAN: 2147483647
Year: 2005
Pages: 129

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