Question

In: Computer Science

IN C# lang Write a console app (review Module 5 for console app) that stores 3...

IN C# lang

Write a console app (review Module 5 for console app) that stores 3 students test stores in 3 separate arrays as integers. Some did not not take all the tests, so they each have a their own length and we use separate arrays.

Declare and initialize each array. Use meaningful names.

Print each array as follows:

Morgan 98, 72, 65
Bowie 15, 47, 35, 92, 94
Ananya 91, 68, 87, 75

Extra credit: Compute the average for each with reusable code (do not have 3 separate pieces of code for the average) This is worth up to 3 points.

Extra extra credit: Ask the user to input the test scores. This is worth up to 2 points.

Submit zipped file. File name is

LastName_M07_ArrayBasics.zip

Solutions

Expert Solution

using System;

class MainClass {

    public static double avg(int[] arr) {
        double sum = 0;
        for(int i=0; i<arr.Length; i++) {
            sum += arr[i];
        }
        return sum/arr.Length;
    }

    public static void Main (string[] args) {
        string[] names = { "Morgan" , "Bowie", "Ananya" };
        int[] score1 = {98, 72, 65};
        int[] score2 = {15, 47, 35, 92, 94};
        int[] score3 = {91, 68, 87, 75};

        Console.WriteLine("Average of " + names[0] + " is " + avg(score1));
        Console.WriteLine("Average of " + names[1] + " is " + avg(score2));
        Console.WriteLine("Average of " + names[2] + " is " + avg(score3));


    }
}


Please upvote, as i have given the exact answer as asked in question. Still in case of any concerns in code, let me know in comments. Thanks!


Related Solutions

Find MIN. Write a C# console app consisting of class MIN with the method CalculateMin() and...
Find MIN. Write a C# console app consisting of class MIN with the method CalculateMin() and the driver class. Print the MIN and MIN's location. Don't count numbers outside the range [0, 100].
write C# console app No arrays Credit card validation Problem. A credit card number must be...
write C# console app No arrays Credit card validation Problem. A credit card number must be between 13 and 16 digits. It must start with: –4 for visa cards –5 for mater cards –37 for American express cards –6 for discover cards •Consider a credit card number 4380556218442727 •Step1: double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number. •Step2: now add...
Needs to be written in C# Console App! Create a base class BankAccount. Decide what characteristics...
Needs to be written in C# Console App! Create a base class BankAccount. Decide what characteristics are common for checking and saving accounts and include these characteristics in the base class. Define derived classes for checking and savings. In your design , do not allow the banking base account to be instantiated --only the checking and saving classes. Use a Program class to test your design.
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( test 1, test 2, and test 3), homework, and final project grades then calculate and display the overall grade along with a message, using the selection structure (if/else). The message is based on the following criteria: “Excellent” if the overall grade is 90 or more. “Good” if the overall grade is between 80 and 90 ( not including...
Module/Week 3 ASSIGNMENT (CONTROL STRUCTURES . IF ..ELSE) Write a C++ program that computes a student’s...
Module/Week 3 ASSIGNMENT (CONTROL STRUCTURES . IF ..ELSE) Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score...
Module 5 Abuse and Neglect assignment CASE 3
CASE #3 You have been assigned to care for the Ross family. The family just had triplets: three girls. The girls were premature, but they are now home after two months in hospital. There are two older children in the family, Ray, age two, and Lori, age five. Although maternal and paternal grandparents are all living, they reside 1600 km away and cannot visit to help. The family seems to be loving and close-knit. The parents seem very happy with the new...
Write a C# console program that fills the right to left diagonal of a square matrix...
Write a C# console program that fills the right to left diagonal of a square matrix with zeros, the lower-right triangle with -1s, and the upper left triangle with +1s. Let the user enter the size of the matrix up to size 21. Use a constant and error check. Output the formatted square matrix with appropriate values. Refer to the sample output below. Sample Run: *** Start of Matrix *** Enter the size of square (<= 21): 5 1 1...
Write a C++ console program that prompts a user to enter information for the college courses...
Write a C++ console program that prompts a user to enter information for the college courses you have completed, planned, or are in progress, and outputs it to a nicely-formatted table. Name the CPP as you wish (only use characters, underscores and number in your file name. DO NOT use blank). Its output should look something like this: Course Year Units Grade ---------- ---- ----- ----- comsc-110 2015 4 A comsc-165 2016 4 ? comsc-200 2016 4 ? comsc-155h 2014...
In C#, write a console-based program that asks a user to enter a number between 1...
In C#, write a console-based program that asks a user to enter a number between 1 and 10. Check if the number is between the range and if not ask the user to enter again or quit. Store the values entered in an array. Write two methods. Method1 called displayByVal should have a parameter defined where you pass the value of an array element into the method and display it. Method2 called displayByRef should have a parameter defined where you...
use c++ 1 a)Write a console program that creates an array of size 100 integers. Then...
use c++ 1 a)Write a console program that creates an array of size 100 integers. Then use Fibonacci function Fib(n) to fill up the array with Fib(n) for n = 3 to n = 103: So this means the array looks like: { Fib(3), Fib(4), Fib(5), ...., Fib[102) }. For this part of the assignment, you should first write a recursive Fib(n) function. .For testing, print out the 100 integers. b) For the second part of this assignment, you must...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT