Answer to Question #296329 in C# for skillie

Question #296329

Student Report Card Application Develop that saves students’ marks information; show position and report card of each student in descending order. Requirements Each student has three subjects (English, Math and Computer). Application will save each student’s marks along with student’s name. Application will calculate total marks. Application will show position and report card in descending order.

Press any following key

Enter Total Students : 2

Enter Student Name : Lakhtey

Enter English Marks (Out Of 100) : 50

Enter Math Marks (Out Of 100) : 60

Enter Computer Marks (Out Of 100) : 30

Enter Student Name : Ali Asad

Enter English Marks (Out Of 100) : 60

Enter Math Marks (Out Of 100) : 70

Enter Computer Marks (Out Of 100) : 30

****Report Card*****

Student Name: Ali Asad, Position: 1, Total: 160/300

Student Name: Lakhtey, Position: 2, Total: 140/300

Use multi-dimension array to store student’s information.

Use loops to iterate over each student’s information to generate report.


1
Expert's answer
2022-02-11T00:27:45-0500


using System;
using System.Collections.Generic;
using System.Globalization;


namespace App
{
    class Program
    {


        static void Main(string[] args)
        {


            Console.Write("Enter Total Students: ");
            int totalStudents = int.Parse(Console.ReadLine());
            string[][] studentsData = new string[totalStudents][];
            //get data
            for (int i = 0; i < totalStudents; i++)
            {
                studentsData[i] = new string[5];
                Console.Write("Enter Student Name: ");
                studentsData[i][0] = Console.ReadLine();
                Console.Write("Enter English Marks (Out Of 100): ");
                studentsData[i][1] = Console.ReadLine();
                Console.Write("Enter Math Marks (Out Of 100): ");
                studentsData[i][2] = Console.ReadLine();
                Console.Write("Enter Computer Marks (Out Of 100): ");
                studentsData[i][3] = Console.ReadLine();


            }
            for (int i = 0; i < totalStudents; i++)
            {
                int total = 0;
                for (int j = 1; j < 4; j++)
                {
                    total += int.Parse(studentsData[i][j]);
                }
                studentsData[i][4] = total.ToString();
            }
            //sort array by Total
            for (int j = 0; j <= studentsData.Length - 2; j++)
            {
                for (int i = 0; i <= studentsData.Length - 2; i++)
                {
                    if (int.Parse(studentsData[i][4]) < int.Parse(studentsData[i + 1][4]))
                    {
                        string[] temp = studentsData[i + 1];
                        studentsData[i + 1] = studentsData[i];
                        studentsData[i] = temp;
                    }
                }
            }
            //display report
            Console.WriteLine("\n****Report Card*****");
            for (int i = 0; i < totalStudents; i++)
            {
                Console.WriteLine("Student Name: {0}, Position: {1}, Total: {2}/300", studentsData[i][0], (i + 1), studentsData[i][4]);
            }


            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS