Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trying to figure out why in the 2nd picture there is an error for Contributions elerence: blic partial class frascorecalculator: Fore List scorelist; int

Trying to figure out why in the 2nd picture there is an error for " image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Contributions elerence: blic partial class frascorecalculator: Fore List scorelist; int scoreTotal, scoreCount; int average; 1 reterences public friscorecalculator() f (lInitializa at1 conponents InitializeConponent(); I/Initialize atd variables clear(); ) private void Clear() 1 f/ Clear textbox values txtscore. Text = txtscore Total. Text = txtscoreCount. Text = txtAverage. Text =; H/Focus the textbox score txtscore.Focus(); //Set scoretist to nen list of integers scoreList = nea List>; 1/ set atL class variables to 0 scorefotal = scoreCount =; average =0 1 (1refences private void btnadd_click(object sender, Eventargs e) /lcheck if textbox score is not empty, then If condition is true. If (txtscore. Text t=) i I/Convert the textbox scere text to int int score = Convert. ToInt16(txtscore. Text): IIIf score is greater than or equal, to zero and scere is less than or equal to:10e, then If conditian If (score se 0 fs $100 ) // Chech if textbox score is not eapty, then if condition is true. if (txtscore. Text 1= " ") f // Convert the textbox score text to int int score = Convert. ToInt16(txtscore. Text); /IIf score is greater than or equal to zero and score is less than or equal to 1ee, then If condition is true if ( score >=0 ss 1) t //Add score to scoreList scoreList. Add(score); I/Increnent score count 5 corecount+1; (/Add score to scoreTotal scoretotal t score; //Pass the score total to textbox txtscoretotal. Text txtscorefotal. Text = score Total. Tostring(O; //Pass the score count to textbox txtscoreCount. Text txtscoreCount. Text = scorecount. Tostring (; //Average is calculated as score total divide by score count average = score total / scorecount; /IPass the average to textbox txtaverage. Text 1 txtaverage, Text = average. Tostring (; 1 else i. I/If user enter score less than a or greater than 100 display message box Messagellox. Show("Enter score in between e to 1e0t", "Error", MessageBoxbuttons.OK, NessageBoxicon. Error); I/If score textbox is eapty then display below message box MessageBox, Shos ("Cannot be epty, Please enter a score valuel", "Information", MessageBoxButtons.ok, MessageboxIcon. Information); Caficulator ) ) In this exercise, you'll modify the Score Calculator form of Homework 3 so the scores are stored in a list instead of an array. 1. Make a copy of and open the ScoreCalculator project you created in part 8-1 above. 2. Replace the declaration for the array variable with a declaration for a List object, and delete the class variable for the score count. 3. Modify the Click event handler for the Add button so it adds the score that's entered by the user to the list. In addition, delete the statement that increments the score count variable you deleted. Then, declare a local variable to store the count, and assign the Count property of the list to this variable. 4. Modify the Click event handler for the Clear Scores button so it removes any scores that have been added to the list. 5. Modify the Click event handler for the Display Scores button so it sorts the scores in the list and then displays them in a dialog box. 6. Test the application to be sure it works correctly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

2. Define communication.

Answered: 1 week ago

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago