Question

write program in c # to do the following : Insert 10 student scores and store...

write program in c # to do the following :
Insert 10 student scores and store them in an array
Create a function that prints array elements
Create a function that returns the highest mark
Create a function that calculates the average score
Create a function that calculates the pass rate, knowing that the pass mark is 60
0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts please comment below. Please give upvote if you like this.

C# Code :

using System.IO;
using System;
using System.Linq;

class Program
{
//Method for Display array
static void printArray( float[] Marks)
{
//Prompt for user
Console.Write("Array Elements :");
//Loop for itterate array elements
foreach( float i in Marks)
{
Console.Write(i+" ");// Display the result
}
}
// Method for Calcute heighest marks
static float heighestMarks(float[] Marks)
{
return Marks.Max(); //return Max marks
}
//Method to calculate average
static double AverageScore(float[] Marks)
{
return (double)(Marks.Sum()/10);; //Return Average
}
//Method for calculate Pass rate
static double PassRate(float[] Marks)
{
float PassSum = 0;//Instalise variable with 0
//Loop itterate array elements
foreach(float i in Marks)
{
//Condition for pass marks
if( i >= 60 )
{
PassSum += i; // Calculate paas sum >=60
}
}
//Return pass rate
return ((double)(PassSum / Marks.Sum()))*100;
}
  
//Main method
static void Main()
{
//Instalise 10 student marks
float[] Marks = { 98, 67, 76, 54, 87, 33, 57, 90, 100, 21 };
//call PrintArray method to print array
printArray(Marks);
// Call the method heighestmarks and display that
Console.Write("\nHeighest Marks is : "+ heighestMarks(Marks));
// Call the method AverageScore and display that
Console.Write("\nAverage Marks is : "+ AverageScore(Marks));
// Call the method PassRate and display that
Console.Write("\nPass Rate is : "+ PassRate(Marks));
}
}

using System.IO; 2 using System; using System.Linq; 4 5 class Program 7 8 9 10 { // Method for Display array static void prin

//Method for calculate Pass rate static double PassRate( float[] Marks) { 28 29 30 31 32 33 34 35 36 37 38 float Passsum 0;//

Array Elements :98 67 76 54 87 33 57 90 100 21 Heighest Marks is : 100 Average Marks is : 68.3 Pass Rate is : 75.841874084919

Add a comment
Know the answer?
Add Answer to:
write program in c # to do the following : Insert 10 student scores and store...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that dynamically allocates an array in the freestore large enough to hold a...

    Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...

  • Write a program that dynamically allocates an array in the freestore large enough to hold a...

    Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...

  • Write a complete C++ program that reads students names and their test scores from an input...

    Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...

  • c++ Instructions Overview In this programming challenge you will create a program to handle student test...

    c++ Instructions Overview In this programming challenge you will create a program to handle student test scores.  You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...

  • Consider the following program that reads students’ test scores into an array and prints the contents of the array. You will add more functions to the program. The instructions are given below.

    Consider the following program that reads students’ test scores into an array and prints the contents of the array.   You will add more functions to the program.  The instructions are given below.              For each of the following exercises, write a function and make the appropriate function call in main.Comments are to be added in the program. 1.       Write a void function to find the average test score for each student and store in an array studentAvgs. void AverageScores( const int scores[][MAX_TESTS],                       int...

  • Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and...

    Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions 1. Function getData: This function reads and stores data in the two- dimensional array. 2. Function averageHigh: This function calculates and returns the aver- age high temperature for the year. 3. Function averageLow:...

  • Write a program that dynamically allocates an integer array of size of 20 to hold a...

    Write a program that dynamically allocates an integer array of size of 20 to hold a user-defined number of test scores. Once all the scores are entered, the array should be passed to • a function that calculates the average score, the minimal score, and the maximal score in the array, and returns these scores to the main function (hint: use pass by reference, I gave an example in the class) • a function that searches a specific number. The...

  • Write a c++ program which uses a structure having the indicated member names to store the...

    Write a c++ program which uses a structure having the indicated member names to store the following data: Name (student name) IDnum (student ID number) Tests (an array of three test scores) Average (average test score) Grade (course grade) The program will keep a list of three test scores for one student. The program may prompt the user for the name, ID number, and test scores, or these may be assigned within the program. The average test score will be...

  • Write a C program that deal with employees’ salaries in a company, as follows: Define an...

    Write a C program that deal with employees’ salaries in a company, as follows: Define an integer array named salaries of size 100 Initialize all array elements with zeros Fill all array elements with random numbers within a range of 350 until 3000 (all inclusive) by using built-in-function rand() and srand() Develop the following functions and call them from the main program: avgSalary(), a function that receives the array and its size as parameters and returns the average salary in...

  • IN C PROGRAMMING PLEASE Write a program to curve 10 scores so that the average is...

    IN C PROGRAMMING PLEASE Write a program to curve 10 scores so that the average is 75.0. Get and store 10 scores in an array. The score must be between 0 and 110 inclusive (use constants for the min and max scores, and use the constants in the validation condition and error message). Then total the scores, find the average of the scores, and calculate the curve amount, which is the difference between 75 and the average (75 should also...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT