Question
Create using C Sharp windows form Create a class Stock to your project. The Stock class should contain the following fields: _numberOfShares, _pricePerShare, _companyName. Add
Create using C Sharp windows form Create a class Stock to your project. The Stock class should contain the following fields: _numberOfShares, _pricePerShare, _companyName. Add constructor and getter properties. Add a method CalculateInvestedValue. This method should compute the value of this investment and return it (investedValue = _numberofshares * _pricepershare). Add method BuyMoreShares. This method should accept the number of shares purchased and update the field: _numberOfShares. It should also return the purchasing cost (Which is just the number of share purchased times the price per share. Add method SellShares. This method should accept the number of shares to sell, update the _numberOfShares field and returns the $ amount the client will get as a result of this transaction.
In Form1, create a list (List<>) to hold Stock objects, and in Form1_load pre-populate it with at least 5 Stock objects, then Add a listview. The listview should contain: company name, current number of shares, pricepershare, and current invested value. Define a method DisplayStokes. It should display all the stocks saved in the stocks list. Call this method from Form_load. Write a method GetStockByName (in Form1) that takes the name of a company and return the Stock object that contains that name, or return null if not found.
Add gui for the user to enter company name and amount of shares to purchase. Add a button to apply the purchasing transaction to the stock with the given name. Add a button to display stock information of the entered company (use the GetStockByName method to get the related Stock object, then apply the buymoreshare transaction on it). The Display All stocks should show changes in the stock.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started