
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
Need help with a java program.
![Firefox
File
Edit
View
History
Bookmarks
Tools
Window
Help
Sun Dec 5 1:29 PM
Welcome Students | Maricopa C X
Lab17
New Tab
X +
1
NEW
o 8 https://learn.maricopa.edu/courses/1196290/assignments/11671791
Lab17.pdf
110A
I, Download
O Info
X Close
ZOOM
+
1) Write method, extractEvens, which accepts an array of int and returns an array containing
only the even integers found in the formal parameter. The returned array should be the right-
size, meaning that all of its elements are used to store an even int found in the parameter. This
means that the returned array may have anywhere from zero to n elements, where n is the
length of the formal parameter array.
2) Write method, compress, which accepts an array of int and returns an array containing the
sums of each pair of integers in the array parameter. So, if arr is the array parameter, then the
first element of the returned array contains the sum arr[0] and arr[1], the second element of
the returned array contains the sum of arr[2] and arr[3], etc. If the array parameter has an odd
number of elements, then the last element of the returned array contains the last element of
the array parameter.
3) Write method, union, which accepts two arrays of int as sets. This means that neither array
contains duplicates within them. This method returns an array that is the union of the two
parameter sets (arrays). The union is also a set and therefore cannot contain duplicates. This
method must make sure that if the two parameter sets have a common element value, then
that value should appear in the union set (array) only once. The union array returned should be
right-sized.
4) Write method, shuffle, which accepts an array of int, creates a copy of the formal parameter,
shuffles the copy, then returns the copied, shuffled array, leaving the formal parameter
unchanged. Shuffling is a process of swapping each element of array with another element
randomly chosen from the array.
5 BONUS Pts: For testing the shuffle method have main call shuffle, repeatedly having it
shuffle its previously returned array until the returned (shuffled) array is identical (equal) to
the original array that was first shuffled. So, your loop would contain a statement like the
following:
shuffledArray
shuffle( shuffledArray );
1,903
DEC
étv
LO](https://content.bartleby.com/qna-images/question/77711788-9c36-4211-88f0-65ee94b70550/927b1486-7dc3-4e87-88ea-305c80d16f74/c10tv3p_thumbnail.png)
Transcribed Image Text:Firefox
File
Edit
View
History
Bookmarks
Tools
Window
Help
Sun Dec 5 1:29 PM
Welcome Students | Maricopa C X
Lab17
New Tab
X +
1
NEW
o 8 https://learn.maricopa.edu/courses/1196290/assignments/11671791
Lab17.pdf
110A
I, Download
O Info
X Close
ZOOM
+
1) Write method, extractEvens, which accepts an array of int and returns an array containing
only the even integers found in the formal parameter. The returned array should be the right-
size, meaning that all of its elements are used to store an even int found in the parameter. This
means that the returned array may have anywhere from zero to n elements, where n is the
length of the formal parameter array.
2) Write method, compress, which accepts an array of int and returns an array containing the
sums of each pair of integers in the array parameter. So, if arr is the array parameter, then the
first element of the returned array contains the sum arr[0] and arr[1], the second element of
the returned array contains the sum of arr[2] and arr[3], etc. If the array parameter has an odd
number of elements, then the last element of the returned array contains the last element of
the array parameter.
3) Write method, union, which accepts two arrays of int as sets. This means that neither array
contains duplicates within them. This method returns an array that is the union of the two
parameter sets (arrays). The union is also a set and therefore cannot contain duplicates. This
method must make sure that if the two parameter sets have a common element value, then
that value should appear in the union set (array) only once. The union array returned should be
right-sized.
4) Write method, shuffle, which accepts an array of int, creates a copy of the formal parameter,
shuffles the copy, then returns the copied, shuffled array, leaving the formal parameter
unchanged. Shuffling is a process of swapping each element of array with another element
randomly chosen from the array.
5 BONUS Pts: For testing the shuffle method have main call shuffle, repeatedly having it
shuffle its previously returned array until the returned (shuffled) array is identical (equal) to
the original array that was first shuffled. So, your loop would contain a statement like the
following:
shuffledArray
shuffle( shuffledArray );
1,903
DEC
étv
LO
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

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
- What are the advantages of being able to learn new programming languages, even if one already knows a number of programming languages?arrow_forwardWhat does it mean when someone tells you to "resist the urge to code" when it comes to computer programming?arrow_forwardWhat is the working of a compiler?arrow_forward
- Next semester, sign up for a class that will teach you how to use a computer programming language. How does one determine which language to study? Is it beneficial for a programmer to be able to work in more than one language? To what extent do you disagree?arrow_forwardwhat is the utilization of Pseudocode in programming.arrow_forward
arrow_back_ios
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