Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am making a C# program in visual and i cant figure out the foreach loop to calculate the average GPA of items in my

I am making a C# program in visual and i cant figure out the foreach loop to calculate the average GPA of items in my list once they have been added to it. Heres my code please help.

image text in transcribed

image text in transcribed

50 // declare vars decimal decCurrent = 0.60m; decimal decRunningTotal = 0.98m; decimal decCurrentGPA = 0.00m; 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 int intNumberOfCourses = 0; int intTotalCredits = 0; 1/count items in the radio button list intNumberOfCourses = Convert.ToInt32(rblClasses0.Items.Count); 1/add number of courses //take number of courses and mult by 3 for credits 1b1NumberCourses. Text = rblClasses0.Items.Count.ToString(); intTotalCredits = intNumberOfCourses * 3; 1b1TotalCredits.Text = intTotalCredits.ToString(); 67 68 69 //calculate gpa foreach (ListItem listItem in rbiclasses. Items) { decCurrent = Convert.ToDecimal(listItem.Value); decRunningTotal += decCurrent; decCurrentGPA = decRunningTotal / Convert.ToDecimal(intNumberOfCourses); 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 lblCurrentGPAQ.Text = decCurrent GPA.ToString(); /** liNumber.Value = Convert.ToDecimal(1 Number.Value); intCurrentGPA = Convert.ToInt32(1iNumber.Value); intCurrentGPA = intCurrentGPA / int NumberOfCourses; No issues found 75 % Error List Entire Solution Code X 0 Errors 1 Warning 60 of 11 Messages *7 Build + IntelliSense Description Validation (HTML5): Element 'table' cannot be nested within element 'span'. Grade Summary System harris, james (Business Analytics) Course History (Add a New Course) Course Prefix: Course Number: Grade Earned: Submit Summary Number of Courses: unknown Current GPA: 0.0 Total Credits: 0 * assuming all courses are 3 credits Cancel A A- B+ Start Over B B- C+ C- D+ D D- F 50 // declare vars decimal decCurrent = 0.60m; decimal decRunningTotal = 0.98m; decimal decCurrentGPA = 0.00m; 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 int intNumberOfCourses = 0; int intTotalCredits = 0; 1/count items in the radio button list intNumberOfCourses = Convert.ToInt32(rblClasses0.Items.Count); 1/add number of courses //take number of courses and mult by 3 for credits 1b1NumberCourses. Text = rblClasses0.Items.Count.ToString(); intTotalCredits = intNumberOfCourses * 3; 1b1TotalCredits.Text = intTotalCredits.ToString(); 67 68 69 //calculate gpa foreach (ListItem listItem in rbiclasses. Items) { decCurrent = Convert.ToDecimal(listItem.Value); decRunningTotal += decCurrent; decCurrentGPA = decRunningTotal / Convert.ToDecimal(intNumberOfCourses); 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 lblCurrentGPAQ.Text = decCurrent GPA.ToString(); /** liNumber.Value = Convert.ToDecimal(1 Number.Value); intCurrentGPA = Convert.ToInt32(1iNumber.Value); intCurrentGPA = intCurrentGPA / int NumberOfCourses; No issues found 75 % Error List Entire Solution Code X 0 Errors 1 Warning 60 of 11 Messages *7 Build + IntelliSense Description Validation (HTML5): Element 'table' cannot be nested within element 'span'. Grade Summary System harris, james (Business Analytics) Course History (Add a New Course) Course Prefix: Course Number: Grade Earned: Submit Summary Number of Courses: unknown Current GPA: 0.0 Total Credits: 0 * assuming all courses are 3 credits Cancel A A- B+ Start Over B B- C+ C- D+ D D- F

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

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

=+What is the procedure for labor relations in the workplace?

Answered: 1 week ago

Question

=+ Are ballots compulsory?

Answered: 1 week ago