Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 20.1: Basic Array Skills Let's work on some basic skills by creating a program that contains a few experiments with arrays. If you are
Lab 20.1: Basic Array Skills Let's work on some basic skills by creating a program that contains a few experiments with arrays. If you are asked to print out a value, be sure to print a label that indicates what the value represents, unless otherwise indicated. For example, ifyou are asked to print a variable z, the output might look like this: z 8.0 Create a new NetBeans project named CPS150 Lab20 1. Add your name at the top after the eauthor tag, and then add Java statements that perform each of the following tasks a Create an array x of 20 random double values, each between 1.0 and 100.0 (.e., declare/create the array, then populate it with 20 random doubles). b) Output the number of items in the array by printing the expression x.length. c) Output the first array item, x[0]. d) Output the last array item. Be careful to choose the right index. e Print the expression x[x.length. 1]. Why is this value the same as in part (d)? Use a for loop to print all the values in the array without labels. g) Use a loop to print all the values in the array with labels to indicate what each element is h) Use a for loop to print all the values in the array in reverse order with labels to indicate what each element is
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