Question: The first think we'll need are some methods in the Program class which can read integers and doubles for us. We've provided the ReadInteger method
The first think we'll need are some methods in the Program class which can read integers and doubles for us. We've provided the ReadInteger method here: 1. Add a public static ReadDouble (string prompt) method yourself. Here's the pseudocode for Main: Create an intvariable called numberOfValues which will store the number of values the user would like to enter. Create an array of double, with a size of numberOfvalues: double[] values = new double[numberOfValues]; Loop over each element in , and populate the array: for (int i = 0; i < numberOfValues; i++) { values[i] = ReadDouble($"Enter the {i + 1}st value: "); } Using a for loop, iterate over each element in values, and write out each element to the console. Next, let's sum all of the values and write that out to the console. You will need to use a double sum variable to sum up each element in the array, before printing it out. Take a screenshot of your program after it has run with a few values, and upload to OnTrack!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
