Using Visual Studio
Create an application that tracks investments. Let the user type a ticker symbol into a
text box, enter the number of shares, and set the purchase date. A sample is shown in
Figure 1-23. In the example, the price per share was obtained from a data file that was
read when the application started. The combo box contains a list of investment types.
When the user selects an investment type and clicks the Confirm button, the total purchase
amount displays in the bottom right corner of the form.
A ticker symbol is a short abbreviation that uniquely identifies the name of an investment
such as a stock. The term ticker refers to the noise made by ticker tape machines
that were once used to print stock prices.
Define a class named PriceType with two properties: Ticker (string), and Price (Double).
Define an enumerated type named InvestmentType that lists four types of investments:
stock, mutual fund, commodity, and money market.
Define a class named Investment containing the following public properties:
• Ticker symbol
• Investment type
• Purchase date
• Price per share
• Number of shares purchased
• Purchase amount (read-only)
The class should contain a shared collection of PriceType objects. Also, create a shared
method in the Investment class that loads PriceType information from a comma-delimited
text file (in real life, we would expect these values to change constantly). Each line
in the text file should look like the following, in which the first value is the ticker symbol,
and the second value is the current price:
The file should contain at least ten lines like this, each with a different ticker symbol and
Create a method in the Investment class that receives a ticker symbol and returns the
price of the investment associated with that ticker symbol.
User Interface Notes
As the user begins to type the ticker symbol into a text box, the application should search
for the symbol and display the price per share. As soon as the ticker symbol matches an
existing symbol in the collection, the price should appear in a label on the form. We suggest
that you write an event handler for the TextChanged event of the TextBox control.
When the user clicks the Confirm button, its click handler should create an Investment
object and initialize its properties with values in the controls on the form.
** In addition to the given specifications, load all file data into memory when the program opens. While the program is running, use the data in memory instead of the file data. When the program is closing, write all data in memory back out to the data file. Create a class to handle file I/O and any additional Investment operations you find suitable for this program
|$40.00||no category||Luminous_Mind||2 time(s)|
|$40.00||no category||jordanblink||0 time(s)|
|$40.00||no category||lightsource||1 time(s)|