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

write a c# console application app that reads all the services in the task manager and...
write a c# console application app that reads all the services in the task manager and automatically saves what was read in a Notepad txt file.  Please make sure that this program runs, also add some comments
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...
Shopping Cart App (C#) Please create a C# Console (.NET Framework) application which reads from the...
Shopping Cart App (C#) Please create a C# Console (.NET Framework) application which reads from the user, the price of items in their shopping "cart". Be sure to tell the user how to stop (or ask them if they want to stop) entering prices. Items can be priced any positive number greater than zero. When the user has entered the prices for all items in their "cart", calculate the subtotal (the sum of all item prices). Next, check if the...
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...
1-Create a new Visual C# Console App (.NET Framework). Name the solution "GPA Calculation". 2-Zip and...
1-Create a new Visual C# Console App (.NET Framework). Name the solution "GPA Calculation". 2-Zip and Submit your entire project with the solution file GPA Ask the user to input their grade percentage (e.g. the use will enter 98 if they had an overall grade of 98% in their course) for their Accounting, Marketing, Economics and MIS courses. Assume each course is worth 3 credit hours. Once you have all of their grades output what letter grade they earned for...
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...
Loops Write a simple C/C++ console application that will calculate the equivalent series or parallel resistance....
Loops Write a simple C/C++ console application that will calculate the equivalent series or parallel resistance. Upon execution the program will request ether 1 Series or 2 Parallel then the number of resisters. The program will then request each resistor value. Upon entering the last resistor the program will print out the equivalent resistance. The program will ask if another run is requested otherwise it will exit.
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT