Parallel Arrays C Sharp Programming | Report Generation in C#
#ParallelArrays #CSharpProgramming #Arrays #ReportGeneration Parallel Arrays C Sharp Programming Like, Share, And Subscribe | Professor Saad Yousuf Watch Our All Videos On This : http://www.youtube.com/ProfessorSaad Subscribe Our Channel : http://www.youtube.com/ProfessorSaad Playlists: https://www.youtube.com/user/ssby79/playlists //parallel array: two or more arrays of same size // and they hold values for the same item in the same spot //for example names = {"Sam", "Jim", "Tom"} // ids = {"111", "112", "113"} // scores = {14, 50, 99} //They help me built a data structure // 1. Display data in columns and calculate and display sum of all scores // 2. Display letter grade for each student based on student score string[] names = { "Samantha", "Jim", "Tom" }, ids = { "111", "112", "113" }; double[] scores = { 14, 50, 99 }; double sum = 0; WriteLine("School Name: Western High School"); WriteLine("Course Name: Welding 101"); WriteLine("Credits: 1.5cr"); WriteLine("Instructor: Jim Lewis"); WriteLine("Year: 2020"); WriteLine("Semester: Fall"); for (int i = 1; i <= 37; i++) Write("-"); WriteLine(); WriteLine("{0,-5}{1,-17}{2,-6}{3,9}", "IDS", "NAMES", "SCORES", "GRADE"); WriteLine("{0,-5}{1,-17}{2,-6}{3,9}", "---", "-----", "------", "-----"); for (int i = 0; i < scores.Length; i++) { string letter = ""; if (scores[i] >= 90 && scores[i] <= 100) letter = "A"; else if (scores[i] >= 80) letter = "B"; else if (scores[i] >= 70) letter = "C"; else if (scores[i] >= 60) letter = "D"; else letter = "F"; WriteLine("{0,-5}{1,-17}{2,-6}{3,9}", ids[i], names[i], scores[i],letter); sum += scores[i]; } for (int i = 1; i <= 37; i++) Write("-"); WriteLine(); WriteLine("Sum of scores: " + sum);
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.