
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write a Java class, XXX_Lab71, where XXX is your Kean email ID. The class
will do the following:
1) Create an Array which can contain 5 elements using an initializer list.
2) The values in the list will be: 11, 22, 33, 44, 55
3) Using an assignment statement, change the element at index position,
3, to 88.
4) Print the elements of the array from first to last using a loop. Use the
length property to print the elements.
5) Print the elements of the array from last to first using a loop. Use the
length property to print the elements.
![An initializer list can be used to create and store values in an array
An initializer list is used whenever the values to be stored in the array are
known beforehand.
The code below creates the array, my List using an initializer list:
double [] myList =
5.6, 4.5, 3.3, 13.2, 4.0, 34.33, 34.0, 45.45, 99.993, 11123};
myList reference
my List[0]
my List[1]
5.6
4.5
myList[2]
3.3
Аrray reference
variable
my List[3]
13.2
myList[4]
4.0
Array element at
index 5
my List [5]
Element value
34.33
myList[6]
34.0
my List[7]
45.45
myList[8]
99.993
myList[9]
11123
An array created using an initializer list is processed the same way as any
other array
The first element of the array,myList, is at index position 0, has the value
5.6 and is referenced by:
myList [0]
The 6th element of the myList Array is at index position 5. Its value is
34.33 and it is referenced by:
myList [5]
Please submit a screen print of the Eclipse editor showing your code and
output with answers:](https://content.bartleby.com/qna-images/question/7468deaa-5c7f-4bd5-9d2d-4646b7d7435e/344f609f-affc-47ed-804e-31f525b3d3d3/zcezaoj.png)
Transcribed Image Text:An initializer list can be used to create and store values in an array
An initializer list is used whenever the values to be stored in the array are
known beforehand.
The code below creates the array, my List using an initializer list:
double [] myList =
5.6, 4.5, 3.3, 13.2, 4.0, 34.33, 34.0, 45.45, 99.993, 11123};
myList reference
my List[0]
my List[1]
5.6
4.5
myList[2]
3.3
Аrray reference
variable
my List[3]
13.2
myList[4]
4.0
Array element at
index 5
my List [5]
Element value
34.33
myList[6]
34.0
my List[7]
45.45
myList[8]
99.993
myList[9]
11123
An array created using an initializer list is processed the same way as any
other array
The first element of the array,myList, is at index position 0, has the value
5.6 and is referenced by:
myList [0]
The 6th element of the myList Array is at index position 5. Its value is
34.33 and it is referenced by:
myList [5]
Please submit a screen print of the Eclipse editor showing your code and
output with answers:
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Language: Java Write a class encapsulating the concept of daily temperatures for a week with a single dimensional array of temperatures. Write the following methods: A constructor accepting an array of seven temperatures as a parameter. Accessor, mutator, toString() and equals() methods A method returning how many temperatures were below freezing. A method returning an array of temperatures above 100 degrees. A method returning the largest change in temperature between any two consecutive days. A method returning an array of daily temperatures, sorted in descending order (do not use a built-in Java class, modify one of the sorting algorithms in the textbook). Write a client class to test all the methods in your class.arrow_forwardhelp with this in javascriptarrow_forward5. How to find all the leaders in an integer array in java? An element is leader if it is greater than all the elements to its right side. And the rightmost element is always a leader. For example int the array {16, 17, 4, 3, 5, 2}, leaders are 17, 5 and 2..arrow_forward
- Language: Javaarrow_forwardJAVA Chapter 9 Multidimensional Arrays and the ArrayList Class Write a value returning method that returns the sum of the elements in the last column of each row in a two-dimensional array of ints. Include code to test your method.arrow_forwardCreate a class: “Question 1” with data members: 1D integer array of maximum size: 100, n(int). Create a dynamic constructor which takes input of n and n no. of array elements. Apartfrom taking input this class also displays the maximum and minimum elements from the givenarray elements.arrow_forward
- In Java please,arrow_forwardin java programming answer the following: Given an array called myArr (created as ArrayList<T>) and contains the {1,2,3,4,5,6,7}. (a) what would be the contents of this array after myArr.add(10). b) write the content of myArr after myArr.add(4, 11);arrow_forwardpython:numpy def shoe_shopping(shoe_arr):'''QUESTION 4You're shopping on a budget and want to determine the cheapest shoe brandgiven an array of brands and prices. Return the brand with the lowestaverage price.Hint: You should create a new array of the prices with the correct dtype.Args:shoe_list(np.arry)Return: string>>> shoe_list1 = np.array([["Nike", "Adidas", "New Balance"],["110.99", "135.99", "94.99"],["85.99", "150.99", "105.99"],["225.99", "145.99", "130.99"]])>>> shoe_shopping(shoe_list1)'New Balance'''' # shoe_arr1 = np.array([["Nike", "Adidas", "New Balance"],# ["110.99", "135.99", "94.99"],# ["85.99", "150.99", "105.99"],# ["225.99", "145.99", "130.99"]])# print(shoe_shopping(shoe_arr1))# shoe_arr2 = np.array([["Converse", "Vans", "Dr. Martens", "Steve Madden"],# ["82.99", "250.99", "180.99", "109.99"],# ["99.99", "150.99", "115.99", "75.99"],# ["125.99", "115.99", "110.99", "99.99"]])# print(shoe_shopping(shoe_arr2))arrow_forward
- Java Task 1 Create an object of type FitnessExperiment that stores an array of StepsFitnessTracker, DistanceFitnessTracker, and HeartRateFitnessTracker objects. You could use code such as the following to initialise the array containing the fitness tracker measurements: FitnessTracker[] trackers = { new StepsFitnessTracker("steps", new Steps(230)), new StepsFitnessTracker("steps2", new Steps(150)), new StepsFitnessTracker("steps2", new Steps(150)), new HeartRateFitnessTracker("hr", new HeartRate(80)), new HeartRateFitnessTracker("hr", new HeartRate(80)) }; In the FitnessExperiment class, complete the implementation of the methods named getTotalSteps()and printExperimentDetails(). The comments in the code specify how they should operate and provide you with additional hints to get you started. You can use the method getSteps()in StepsFitnessTracker, but think how you will know the real type of each object in the array of fitness trackers (trackers in the example above). FitnessTracker…arrow_forwardin java Integer numVals is read from input and integer array userCounts is declared with size numVals. Then, numVals integers are read from input and stored into userCounts. If the first element is less than the last element, then assign Boolean firstSmaller with true. Otherwise, assign firstSmaller with false. Ex: If the input is: 5 40 22 41 84 77 then the output is: First element is less than last element 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import java.util.Scanner; public class UserTracker { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); intnumVals; int[] userCounts; inti; booleanfirstSmaller; numVals=scnr.nextInt(); userCounts=newint[numVals]; for (i=0; i<userCounts.length; ++i) { userCounts[i] =scnr.nextInt(); } /* Your code goes here */ if (firstSmaller) { System.out.println("First element is less than last element"); } else { System.out.println("First element is not less…arrow_forwardPart 2: Coding 1. Write a complete Java program named FindAverage that contains the following: a. A main method that asks the user to provide the number of rows and columns for a 2- dimensional array of integers. b. A main method calls the getArray() method that creates the 2D array of specified size and populates it with random values from 0 to 100. c. A main method prints the elements of the 2D array created by getArray(). d. A main method calls the printAverage method that will: i. Receive the two-dimensional array as input ii. Calculate the average of elements in this array iii. Display the average on the console. The average of all elements should be formatted as xxx.XX. Hint: you can print the 2D array at any point in the program using either traditional for loop, foreach loop or available methods in java.util package. e. Add comments to your program. Start your program with the following header: *** *** ***** /**** ***arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education