Using visual studio C#
Create a method for generating 3 random scores.
You decide to go for array/list/dictionary. Set the return type and
other stuff consistently.
Use a loops inside the method to generate random scores and assign
scores to the data structure.
Return the structure as a whole.
Clarification: One run of the method is to generate data for one
student. You need to run the method 4 times, one for each
student.
Keep other things the same. That is:
2-dimension structure
Calculate average score
Display all scores and average score
Call students as Jim, Corey, Rick, and Bryan
Hi,
Program:
// C# program to demonstrate the
// boolean data type
using System;
using System.Collections;
using System.Collections.Generic;
namespace ValueTypeTest {
class GeeksforGeeks {
// Main function
static void Main()
{
Console.WriteLine("----------------");
Console.WriteLine("Jim
marks:");
int sum =0;
ArrayList jim = genscores();
foreach(int i in jim)
{
Console.WriteLine(i);
sum +=i;
}
Console.WriteLine("Average:" +
sum/3);
Console.WriteLine("----------------");
Console.WriteLine("Corey
marks:");
sum =0;
ArrayList c = genscores();
foreach(int i in c)
{
Console.WriteLine(i);
sum +=i;
}
Console.WriteLine("Average:" +
sum/3);
Console.WriteLine("----------------");
Console.WriteLine("Rick
marks:");
sum =0;
ArrayList r = genscores();
foreach(int i in r)
{
Console.WriteLine(i);
sum +=i;
}
Console.WriteLine("Average:" +
sum/3);
Console.WriteLine("----------------");
Console.WriteLine("Bryan
marks:");
sum =0;
ArrayList b = genscores();
foreach(int i in b)
{
Console.WriteLine(i);
sum +=i;
}
Console.WriteLine("Average:" +
sum/3);
}
static ArrayList genscores(){
Random rand = new Random();
ArrayList myList = new ArrayList(10);
for(int i=0;i<3;i++){
int index = rand.Next(40, 100);
myList.Add(index);
}
return myList;
}
}
}
output:
----------------
Jim marks:
93
41
40
Average:58
----------------
Corey marks:
98
52
88
Average:79
----------------
Rick marks:
98
52
88
Average:79
----------------
Bryan marks:
98
52
88
Average:79
Screenshot:
Using visual studio C# Create a method for generating 3 random scores. You decide to go...
Piggy back on the programming project one you completed in module 3. You will use some of those concepts here again. We will be building this project inside out, start individual quiz and use a for loop to repeat it three times for three students. In this program you will be required to write a python program that generates math quizzes for students in second grade. Your program should do the following Ask the student for their name Provide 3...
python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...