Implement a program that randomly generates 10 integers from -100 to 100, stores them in a 1D array, and finds their maximum value. Calculate the execution time of finding a maximum. Repeat the test for 10,000 and 10,000,000 numbers.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

. Implement a program that randomly generates 10 integers from -100 to 100,
stores them in a 1D array, and finds their maximum value. Calculate the
execution time of finding a maximum. Repeat the test for 10,000 and
10,000,000 numbers. Provide your results in the form of a table below and
provide a small summary.

Implement a Java program that will populate a 5x5 matrix with randomly
generated integers from 0 to 100.
(1) print your matrix in a table form.
(2) modify your code to multiply all even numbers by 10 and print the matrix.

Your output of questions (1) and (2) should match the format of the following
sample outputs: 

Lab 3: 1-D Array Operations X Untitled document - Google X
← → C
CPS 2231 Assignment2.pdf
44°F
Mostly cloudy
kean.instructure.com/courses/12224/assignments/56660
Assignments
Array size
Time
Assignment 2: 1D & 2D Array X
// put your code here.
end = System.nanoTime();
time = end - begin;
10
▬▬
b My Questions | bartleby X
O Search
10,000
Hint: You can use the following to generate random numbers:
(int) (Math.random() * 101 * (Math.random() > 0.5 ? 1: -1));
Page <
Hint: You can use the following statements to calculate execution time.
long begin, end, time; // we will measure time it took
begin = System.nanoTime(); //we measure in nanoseconds.
a
New Tab
1
> of 3
10,000,000
Sample run:
It took 22000 nanoseconds to find a maximum in the array of 10 elements. The maximum is: 100.
X +
Download
R=J
i Info
ZOOM +
J
X Close
O
9:43 PM
2/9/2023
X
Transcribed Image Text:Lab 3: 1-D Array Operations X Untitled document - Google X ← → C CPS 2231 Assignment2.pdf 44°F Mostly cloudy kean.instructure.com/courses/12224/assignments/56660 Assignments Array size Time Assignment 2: 1D & 2D Array X // put your code here. end = System.nanoTime(); time = end - begin; 10 ▬▬ b My Questions | bartleby X O Search 10,000 Hint: You can use the following to generate random numbers: (int) (Math.random() * 101 * (Math.random() > 0.5 ? 1: -1)); Page < Hint: You can use the following statements to calculate execution time. long begin, end, time; // we will measure time it took begin = System.nanoTime(); //we measure in nanoseconds. a New Tab 1 > of 3 10,000,000 Sample run: It took 22000 nanoseconds to find a maximum in the array of 10 elements. The maximum is: 100. X + Download R=J i Info ZOOM + J X Close O 9:43 PM 2/9/2023 X
Lab 3: 1-D Array Operations X Untitled document - Google X
← → C
CPS 2231 Assignment2.pdf
44°F
Mostly cloudy
Assignment 2: 1D & 2D Array X
kean.instructure.com/courses/12224/assignments/56660
Assignments
b My Questions | bartleby X
Page < 2
> of 3
12/ mouny your coue to marciply an even numbers by 10 and print the matha.
Initial Matrix:
Your output of questions (1) and (2) should match the format of the following
sample outputs:
941
541
211
59|
361 901 821 41|
851 871 35| 100|
21| 661 231
791
2
100| 01 31|
861 14| 421 561
141
New Matrix:
851 871
211 6601
20 1000
8601
140
35 1000
231 791
0| 31|
140| 420| 5601
360 900 820|
New Tab
9401
5401
21|
59|
411
a
(3) After multiplying all even numbers by 10, write code to sum all elements in
each row and print the results.
O Search
X +
Download
R=J
i Info
ZOOM +
J
X Close
O
9:44 PM
2/9/2023
X
Transcribed Image Text:Lab 3: 1-D Array Operations X Untitled document - Google X ← → C CPS 2231 Assignment2.pdf 44°F Mostly cloudy Assignment 2: 1D & 2D Array X kean.instructure.com/courses/12224/assignments/56660 Assignments b My Questions | bartleby X Page < 2 > of 3 12/ mouny your coue to marciply an even numbers by 10 and print the matha. Initial Matrix: Your output of questions (1) and (2) should match the format of the following sample outputs: 941 541 211 59| 361 901 821 41| 851 871 35| 100| 21| 661 231 791 2 100| 01 31| 861 14| 421 561 141 New Matrix: 851 871 211 6601 20 1000 8601 140 35 1000 231 791 0| 31| 140| 420| 5601 360 900 820| New Tab 9401 5401 21| 59| 411 a (3) After multiplying all even numbers by 10, write code to sum all elements in each row and print the results. O Search X + Download R=J i Info ZOOM + J X Close O 9:44 PM 2/9/2023 X
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Show all of this in Java

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Arrays
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
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education