Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Visual Studio Student Test Scores Program using Console application PLEASE POST

ID: 3719963 • Letter: V

Question

Visual Studio Student Test Scores Program using Console application PLEASE POST CODE THAT RUNS AS CONSOLE APP IN VISUAL STUDIOI :) Alteacher has six students and wants you to create a program that stores their grade data in a file anc prints a grade report. The program should have a structure that stores the following student data: Name (a string), Test Scores (an array of five Doubles), and Average (a Double). Because the teacher has six students, the program should use an array of six structure variables. The program should allow the user to enter data for each student, and calculate the average test score. REQUIREMENTS: The user should be able to . Save the data to a file (10 points) Read the data from the file (10 points) Sum the test scores for each student (15 points) Average of each student (15 points) Print a report showing each student's test scores and average score (15 points) Input validation: Do not accept test scores less than zero or greater than 100. (10 points) Comments throughout the program (25 points) Test Data Student Student Test Score Test Score Test Score Test Score Test Score Average First Name Mickey Mouse70 1 10] 211) 4 (3) 5 141 Last Name 85 79 90 98 87 87 72 81 92 94 82 94 80 80 89 85 84 68 87 82 93 Minnie Mouse 88 78 67 DonaldDuck Daisy Duck Goofy Disney75 Pluto Disney 85 89 91 Tips: 1, Use the Sum of Numbers program (#3 page 428) 2. Use the Average of Numbers program (#4 page 428) 3. BONUS: Largest Number program (#5 page 428) who had the highest average? who had the highest test score? i Additional BONUS: Use Windows Application Forms to create this program (30 points)

Explanation / Answer

using System;
   
public struct students// students structure to store 6 students data
{
public string nameF;
public string nameL;
public double[] test_score;
public double average;
};
public class Program
{
public static int getdataFromFile(int index_,students[] obj)//to read data from file
{
  //incomplete..will complete soon
  return index_;
}
public static void commitdataInFile(int index_,students[] obj)//to store data from filestore data in file
{
  //incomplete..will complete soon
}
public static int getdata(int index_,students[] obj)//to read data from user
{
  for(int i=index_;i<2;i++)
  {
   obj[i].test_score=new double[5];
   Console.WriteLine("Data for Student-"+(i+1)+".");
   Console.WriteLine(".........................");
   Console.Write("Enter First Name:");
   obj[i].nameF=Convert.ToString(Console.ReadLine());
   Console.Write("Enter Last Name:");
   obj[i].nameL=Convert.ToString(Console.ReadLine());
   for(int j=0;j<5;j++)//set test score value to -1 to check valid data and renter from user in invalid data in entered
   {
    obj[i].test_score[j]=-1;
   }
   for(int j=0;j<5;j++)//get 5 test-scores from user
   {
    Console.Write("Enter Test Score-"+(j+1)+":");
    while(obj[i].test_score[j]<0||obj[i].test_score[j]>100)//get score from user till entered score lie between 0 to 100
    {
     obj[i].test_score[j]=Convert.ToDouble(Console.ReadLine());
     if(obj[i].test_score[j]<0||obj[i].test_score[j]>100)//print error message if entered score does not lie between 0 to 100
     {
      Console.WriteLine("Invalid Test Score-"+(j+1)+" Please Enter Valid Test Score:");
     }
    }
   }
   double sum=0;
   for(int j=0;j<5;j++)//get sum of all test score of a student
   {
    sum=sum+obj[i].test_score[j];
   }
   obj[i].average=sum/5;//store average
   Console.WriteLine("Average Stored Automatically");
   index_++;
  }
  return index_;//return number of student data entered
}
public static void dispalyReport(int index_,students[] obj)//to display data
{
  Console.WriteLine("Students Report");
  Console.WriteLine("...................");
  Console.WriteLine("First Name Last Name Test Score-1 Test Score-2 Test Score-3 Test Score-4 Test Score-5 Average Score");
  for(int i=0;i<index_;i++)
  {
   Console.Write(obj[i].nameF+" ");
   Console.Write(obj[i].nameL+" ");
   Console.Write(obj[i].test_score[0]+" ");
   Console.Write(obj[i].test_score[1]+" ");
   Console.Write(obj[i].test_score[2]+" ");
   Console.Write(obj[i].test_score[3]+" ");
   Console.Write(obj[i].test_score[4]+" ");
   Console.Write(obj[i].average+" ");
  }
}
public static void Main()
{
  int ch=-1;
  int index=0;
  students[] obj=new students[6];
  index=getdataFromFile(index,obj);//gete data from file
  while(ch!=4)//to create menu for user for beter program interface and flow
  {
   Console.WriteLine(" 1) Enter Data");
   Console.WriteLine(" 2) Dispaly Report");
   Console.WriteLine(" 3) Exit");
   Console.Write("    Enter Your choice:");
   ch=Convert.ToInt32(Console.ReadLine());
   switch(ch)
   {
    case 1:
    if(index<6)//check if students array have space or not
    {
     index=getdata(index,obj);//if yes then get data from user
    }
    else
    {
     Console.WriteLine("Data Full");//if not print error message
    }
    break;
    case 2:
    if(index>0)//check if students oject have data or not
    {
     dispalyReport(index,obj);//if yes then print data by calling dispaly function
    }
    else
    {
     Console.WriteLine("No Data Found");//if not print error message
    }
    break;
    default:
     if(ch!=3)//check if user entered valid choice or not
     {
      Console.WriteLine("Invalid Choice..!!");//if not print error message
     }
    break;
   }
  }
}
}