In: Computer Science
Using C# create a new grade book program for a teacher.
We have a class with 10 students who have each taken 5 tests. Create an array to hold:
Use a random number generator to generate the test scores for each student. The student names may be hard-coded into the array.
Create and call a method that calculates and stores each student’s average in the array.
Create and call a method that displays the grades and average for each student.
using System;
namespace Main {
    
    // string name;
    // int marks[5];
    // string color="red"    ;
    
    class Grades{
        public string name;
        public int[] marks=new int[5];
        public double average;
        
        
        public Grades(string name, int [] arr){
            this.name=name;
            this.marks=arr;
        }
        
        public void calculate(){
            int sum=0;
            for(int i=0;i<5;i++)
            sum+=marks[i];
            
            average=(sum)/5;
        }
        
        public void showdata(){
            Console.WriteLine("Name: "+name);
            for(int i=0;i<5;i++)
            Console.WriteLine("Marks in subject {0}={1}",i+1,marks[i] );
            
            Console.WriteLine("Average is :"+average);
            
        }
        
    }
        
    
    class helperclass{
    
        public static void Main(string[] args) {
                
                int n=10; // students 
                
                for(int i=1;i<=10;i++){
                string name;
                int[] marks=new int[5];
                
                name=Console.ReadLine(); // input name 
                for(int j=0;j<5;j++)
                {
                    Random r=new Random();
                    marks[j]=r.Next(1,100); // genrate marks
                }
                
                Grades g= new Grades(name,marks);
                g.calculate();
                g.showdata();
                Console.WriteLine();
                
                }
    
                
        }
        
    }
}