Need help!

User Generated

Fhcre_O

Computer Science

Description

Add the following comments to the top of the code:

·Name

·Class and section (CS 166 02)

·Exercise Assignment (Chapter 10 Exercise)

·Due Date (see above)

·Description of the program

Unformatted Attachment Preview

CS 166 02 Exercise Assignment Chapter 10 5 Points Name _______________________________ Due: Tuesday, November 20, 2018 Complete Exercise 10-1 on page 271. The folder Chapter 10 Exercise is located in the I:\kopp\outbox\CS 166 02\Exercise Assignments folder. Use this folder for the assignment. Add the following comments to the top of the code: • Name • Class and section (CS 166 02) • Exercise Assignment (Chapter 10 Exercise) • Due Date (see above) • Description of the program In order to receive credit, complete the following: • Print the source code for all code • Attach this sheet to the front of the source code with your name written in the appropriate place • Copy the folder mentioned above for this assignment to your folder in the I:\kopp\inbox\CS 166 02 folder. Chapter 10 How to work with arrays 271 Exercise 10-1 Use a one-dimensional array In this exercise, you can get some practice using one-dimensional arrays. 1. Import the project named ch10_exl_Array Test in the ex_starts directory. Then, open the Main class. 2. Create a one-dimensional array of 99 double values. Then, use a for loop to add a random number from 0 to 100 to each element in the array. To do that, you can call the random method of the Math class and multiply it by 100 like this: Math.random() * 100 3. Use an enhanced for loop to sum the values in the array. Then, calculate the average value and print that value to the console like this: Average : 50.9526671843517 4. Use the sort method of the Arrays class to sort the values in the array, and print the median value (the 50th value) to the console like this: Median: 52.18369291650803 5. Print the 9th value of the array to the console and every 9th value after that like this: Position: 9 8.927702403161032 Position: 18 14.053128749806076 ... Position: 99 22.471670293184822
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Ch...


Anonymous
Really useful study material!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags