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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started