Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Microsoft Visual C# 2017 pages 346 Please keep these as basic as possible so that I can understand and follow how it was done. I

Microsoft Visual C# 2017 pages 346

Please keep these as basic as possible so that I can understand and follow how it was done.

I need help adjusting my code to match the screenshot below and it HAS to end with "press any key to continue" when the input "999" is entered.

It also needs to list the input number of 1 through 10.

using System; using static System.Console; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace IntegerFacts { class Program { static void Main(string[] args) { int[] nums = new int[10]; int high, low, sum; double avg; int numberOfEntries; numberOfEntries = FillArray(ref nums); CalcIntegerFacts(nums, numberOfEntries, out high, out low, out sum, out avg);

WriteLine(); WriteLine("The array has {0} values", numberOfEntries); WriteLine("The highest value is {0}", high); WriteLine("The lowest value is {0}", low); WriteLine("The sum of the values is {0}", sum); WriteLine("The average is {0}", avg); WriteLine(); }

public static int FillArray(ref int[] nums) { const string SENTINEL = "999"; string input = ""; int num; int countEntries = 0;

for (int x = 0; x

public static void CalcIntegerFacts(int[] nums, int numberOfEntries, out int high, out int low, out int sum, out double avg) { high = nums[0]; for (int x = 0; x high) high = nums[x];

low = nums[0]; for (int x = 0; x

sum = 0; for (int x = 0; x

avg = (double)sum / numberOfEntries; }

} } }image text in transcribed

C:Windows system32\ cmd.exe Enter a number or 999 to exit 11 Enter a number or 999 to exit 2 Enter a number or 999 to exit Enter a number or 999 to exit 4 Enter a number or 999 to exit Enter a number or 999 to exit Enter a number or 999 to exit Enter a number or 999 to exit Enter a number or 999 to exit Enter a number or 999 to exit 10 2345678910 The array has 10 values The highest value is 10 The lowest value is 1 The sum of the values is 55 The average is 5.5 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago