Im working in visual basic and im having trouble with the code for this. Thanks
ID: 3810853 • Letter: I
Question
Im working in visual basic and im having trouble with the code for this. Thanks in advance for the help.
The Dogs of the Dow is an investment strategy popularized by Michael B. O Higgins in 1991, which proposes that an investor annually select for investment the ten Dow Jones Industrial Average (DJIA) stocks whose dividend is the highest fraction of their price. The purpose of this project is to read in a values from DOW2014.txt Ea and display an ordered list similar to the screen shown below. Dow Determine the Dogs of the Dow Yield as of A Company Symbol 12/31/2014 T AT&T; 5.51 VZ Verizon 4.62 Chevron Corporation CVX 3.82 GE General Electric 3.52 McDo McDonald's 3.50 Pfizer PFE 3.40 Merck MRK 3.12 ExonMobil XOM 2.99 Caterpillar CAT 2.95 Coca-Cola 2.89 Create a Structure named Stock consisting of the below members. The data record structure matches the displayed order of the members. Company symbol exchange ndustry price 2013 'price at end of 2013 price2014 'price at end of 2014 earnings PerShare dividend Read in all values from the input file into an array of type Stock. Use a LINQ query to determine each dividend ratio (dividend price2014). Order the equities in descending order by their dividend ratio Display the results in a DataGridview control. Rename the columns as: Compan Company symbol Symbo ratio 'Yield as of 12/31/2014Explanation / Answer
To complete this assignment you have to use struct in your c# code, below is an example for the same...I hope this helps.
using System;
struct Stock
{
public string Company;
public string Symbol;
public string Exchange;
public String Industry;
public double Price2013;
public double Price2014;
public double earningsPerShare;
public double dividend;
};
public class StockStructure
{
public static void Main(string[] args)
{
int counter = 0;
string line;
//Read the file and display it line by line.
System.IO.StreamReader file = new System.IO.StreamReader("DOW2014.txt");
while((line = file.ReadLine()) != null)
{
//create Stock object and store all the values from file
//Stock s1;
//s1.Company
//s1.Symbol...
}
file.Close();
Console.ReadKey();
}
}
//Use data grid control in visual basic and prepare the GUI and populate it