For this practice you will build an application that allows the user to input te
ID: 3675581 • Letter: F
Question
For this practice you will build an application that allows the user to input test scores in a textbox, adding each one to a list box. Once all the scores are entered, clicking on a “Calculate” button will trigger methods to calculate the average, maximum and minimum scores. The application form should look something like this in C#:
1) Create the user interface (Form), name the form and controls appropriately. This time you will add a -> the Listbox
2) Create an event-handler for the “Add” button. In this method you will write the code that gets the score input from the textbox and adds it to the listbox. Adding the score to the listbox is as simple as this:
scoresListbox.Items.Add(score);
Also make sure the textbox gets cleared after the score is added to the listbox, and the focus is set to it again.
3) Create an event-handler for the “Calculate” button. In this method you will write the code that takes all items from the listbox and adds it an array of “doubles.” Make sure you add validation and exception handling also. The size of the array will be the size of the listbox, which you get from something like this:
scoresListbox.Items.Count;
Also in order to add each score to the array you will need to do a type conversion because each item is actually an “object” type. You need to convert the listbox “item” to to double (because the array is an array for values of type “double”). The loop will have something like this
: scoresA[i] = Convert.ToDouble(scoresListbox.Items[i])
; 4) Three methods will be called from the Calculate event handler: scoreAvg, scoreMax, and scoreMin.
• The “scoreAvg” and “scoreMax” methods will require the array passed to them.
• The “scoreMin” will need to be run after “scoreMax” because it will require not only the array passed to it but also the max value.
• Each of these metho will return the result to the calling statement. So write the calling statement of each of them. As you do that, intellisense will ask you if you would like to create the method stub (for which you are writing the call); click on that and you will have the skeleton of the method created for you. Do that for each of the method calls.
5) Write the code in each of the 3 new methods accordingly and make sure to return the result to the calling statement.
6) Back in the Calculate event-handler write code to display each result back to their respective textboxes.
7) Write code for the Clear event-handler
8) Write code for the Exit event-handler
Explanation / Answer
Plz download souce code using bellow link then run the application.let me know your comments
http://we.tl/h6TQHwxul0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.