Answered step by step
Verified Expert Solution
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 "
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 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