The Premier Application You will use a Dictionary to drive this application. The Key will be...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The Premier Application You will use a Dictionary to drive this application. The Key will be the last name of the premier (there is a method in the Premier class that generated a key) and the value will be the premier object. The images are in a folder on the p drive. The images are named also by the premier's last name. Ontario's Premiers Bob Rae Ross Whitney Hearst Drury Ferguson Henry Hepbum Conant Nixon (b. 1948) 1 October 1990-26 June 1995 Drew Kennedy Frost Robarts Davis Miller Peterson Rae You should use the file Premier.cs file. [See appendix for the logic for the Premier class] Additions to your Form1.cs file: 1. Declare a variable to store the premiers which should be declared as: Dictionary<string, Premier> premiers. 2. Create a method InitializeGui() that will populate a Dictionary with from a List| and use the keys from the resulting dictionary to populate a ListBox. This method does the following: al a. Initialize the above variable using the following logic: This InitializeGui() method is invoke in the last line of the From1 constructor. n.k.p Winter2022 Page 2 of 4 Programming II Window Forms: PictureBox, ListBox, Dictionary Week12_Lab20 i. Initialize to an empty collection. ii. iii. Obtain a list of premier by calling the static GetPremier () of the Premier class. For each premier add a pair to the dictionary 3. • The key of the pair is obtain by calling GenerateKey ( ) on the current object. The value of the pair is the current object. b. You should populate the ListBox here. This listbox contain the keys in the dictionary wwwwwwwwwwwwwwww i. Create a list from the dictionary keys, and then assign it to the DataSource property of this control. Create a UpdateGui(string key) method that will do the following: a. Retrieves the premier object based on the argument (key). b. The Name property of the above object is assigned to the Text property of the first label. c. The Life property of the above object is assigned to the Text property of the second label. d. The Start and End properties of the above object is assigned to the Text property of the third label. e. {image folder}\\key + ".jpg" will goes to the name of the image file. You need to download the zipped archive of the premier's pictures and unzip to a folder in your bin\Debug folder 4. Add a SelectedValueChanged event handler for the ListBox. This will call the previous method with the key as argument. Use the MessageBox.Show() method as a debugging tool. The Premier Application You will use a Dictionary to drive this application. The Key will be the last name of the premier (there is a method in the Premier class that generated a key) and the value will be the premier object. The images are in a folder on the p drive. The images are named also by the premier's last name. Ontario's Premiers Bob Rae Ross Whitney Hearst Drury Ferguson Henry Hepbum Conant Nixon (b. 1948) 1 October 1990-26 June 1995 Drew Kennedy Frost Robarts Davis Miller Peterson Rae You should use the file Premier.cs file. [See appendix for the logic for the Premier class] Additions to your Form1.cs file: 1. Declare a variable to store the premiers which should be declared as: Dictionary<string, Premier> premiers. 2. Create a method InitializeGui() that will populate a Dictionary with from a List| and use the keys from the resulting dictionary to populate a ListBox. This method does the following: al a. Initialize the above variable using the following logic: This InitializeGui() method is invoke in the last line of the From1 constructor. n.k.p Winter2022 Page 2 of 4 Programming II Window Forms: PictureBox, ListBox, Dictionary Week12_Lab20 i. Initialize to an empty collection. ii. iii. Obtain a list of premier by calling the static GetPremier () of the Premier class. For each premier add a pair to the dictionary 3. • The key of the pair is obtain by calling GenerateKey ( ) on the current object. The value of the pair is the current object. b. You should populate the ListBox here. This listbox contain the keys in the dictionary wwwwwwwwwwwwwwww i. Create a list from the dictionary keys, and then assign it to the DataSource property of this control. Create a UpdateGui(string key) method that will do the following: a. Retrieves the premier object based on the argument (key). b. The Name property of the above object is assigned to the Text property of the first label. c. The Life property of the above object is assigned to the Text property of the second label. d. The Start and End properties of the above object is assigned to the Text property of the third label. e. {image folder}\\key + ".jpg" will goes to the name of the image file. You need to download the zipped archive of the premier's pictures and unzip to a folder in your bin\Debug folder 4. Add a SelectedValueChanged event handler for the ListBox. This will call the previous method with the key as argument. Use the MessageBox.Show() method as a debugging tool.
Expert Answer:
Answer rating: 100% (QA)
Heres an approach to solve the problem Create the Dictionary In your Form1 class youve already declared a Dictionary named premiers to store the premier objects Ensure that the Premier class has a Gen... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The goal of this assignment is to spell check a single word. You will use a dictionary le in order to decide if a word is correct. I provide two dictionary les small-dictionary.txt and dictionary.txt...
-
Vijay Company reports the following information regarding its production costs. Compute its production cost per unit under absorption costing. Direct materials.................................. $ 10...
-
If an initial fiscal restraint of $100 billion is desired, by how much must 1. Government spending be reduced? or 2. Taxes be raised? Assume MPC = 0.75.
-
A curve is such that where k is a constant. The point P(3, 2) lies on the curve and the normal to the curve at P is x + 4y = 11. Find the equation of the curve. dy dx 4 2x + k
-
Consider the following cash flow profile, and assume MARR is 10 percent/year. a. What does Descartes' rule of signs tell us about the IRR(s) of this project? b. What does Norstrom's criterion tell us...
-
The following audit procedures were performed in the audit of inventory to satisfy specific balance-related audit objectives as discussed in Chapter 6. The audit procedures assume that the auditor...
-
Use the attached image and SQL DDL Commands to query the appropriate tables and populate with four rows of data. Please include explanation for script. CUSTOMER PK CustomerID CustomerName Address...
-
The following matrix shows the payoffs for advertising game between Coke and Pepsi. The firms can choose to advertise or to not advertise. Number in the matrix represent profits; the first number in...
-
2) An elevator of mass m is lifted by a winch with a masslesscable through two frictionless, massless pulleys. (i) Draw relevant free-body diagrams. (ii) If the elevator is at rest, what is the...
-
Ethan is 0.73 meters tall standing 9.05 meters away from Sreekanth who is 2.2 meters tall. If Ethan looks at Sreekanth's head, what is the angle, in degrees, of elevation of Ethan's eyes?
-
An electromagnetic wave is radiated from an antenna with a frequency of 50.0 kHz. This electromagnetic wave has an average intensity of 76.5 MW/m. (a) What is the wave's maximum magnetic field...
-
An electric wire carries a dc current of 40 A vertically upward. (a) What is the magnetic field due to this current at a point P, 10 cm due north of the wire ? (b) What is its direction?
-
One vector has coordinates (1.58, -9.78). A second vector has coordinates (-9.16, -3.8). What is the magnitude of their sum?
-
One vector has magnitude 8 and is at an angle 33. A second vector has magnitude 9 and is at an angle 357. What is the x component of their sum?
-
For a balanced three-phase system (phase a, b, c) with a-phase voltage Van = 100445 , calculate and plot the following voltages in a phasor diagram: a) the phase voltages b) the line voltages
-
What types of questions can be answered by analyzing financial statements?
-
The North of Superior Brewing Company plans to launch a major media campaign. Three advertising companies prepared trial commercials in an attempt to win a $2 million contract. The commercials were...
-
A sociologist at Grant MacEwan University selects 12 men and 12 women from each of 4 English classes.
-
A genetics expert has determined that for certain couples, there is a 0.25 probability that any child will have an X-linked recessive disorder. a. Find the probability that among 200 such children,...
-
Sheds Ahead Ltd produces outdoor sheds for domestic use. The manager in charge of production has been asked to prepare a production budget, a direct materials budget and a direct labour budget for...
-
Sami Stitches Ltd produces two types of sewing machines, a standard model and a deluxe model. The budgeted factory overhead costs for the production operation during 2020 are as follows. Production...
-
Gasmania Pty Ltd produces patio heaters for household use. The following information has been gathered so that a production budget, a direct materials budget and a direct labour budget for part of...
Study smarter with the SolutionInn App