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
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));
}
}
write program in c # to do the following : Insert 10 student scores and store...
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 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 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 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. 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 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 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 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 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++ Assignment 8 - Test Scores Be sure to read through Chapter 10 before starting this assignment. Your job is to write a program to process test scores for a class. Input Data You will input a test grade (integer value) for each student in a class. Validation Tests are graded on a 100 point scale with a 5 point bonus question. So a valid grade should be 0 through 105, inclusive. Processing Your program should work for any...