Database System Concepts
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
Bartleby Related Questions Icon
Related questions
Question
in java ecplise
. 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:
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
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
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Background pattern image
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
- Write a java program. Write a method getDecimalArray that recieves an array named octalArray containing values 0, 121, 3232, 0, 4565, 67654, 79867. The task is to compute the decimal representations of all the numbers in octalArray and store the decimal representations in another array named decArray with int datatype. Hint: You'll need to implement nested loops, outer for the traversal of octalArray and inner for the computayion of decimal representation of current octal number.For 121 = (1*81)+(2*81)+(1*80)arrow_forwardUse Java to write a program that prompts the user for a positive odd integer , generates a normal magic square of order size of that integer, and prints it with numbers right-justified and aligned in evenly-spaced columns. (Magic square definition: https://en.wikipedia.org/wiki/Magic_square. Can assume that the numbers in the square are 3 digits or less (i.e. size ≤ 31). Have the construction of the 2D integer array magic square take place in a public static method getMagicSquare that takes in an integer n as a parameter and returns the 2D integer array magic square as specified. Your main method should perform input and output (I/O) and call this method to perform the computation. Methods for generating a magic square : Assign 1 to our initial current position: the bottom row, middle column. Place each successive value (up to size * size) in the first of the following positions that is unoccupied: (1) one space down and to the right, or (2) one space up. Positions wrap around...arrow_forwardConsider an array of length n containing unique integers in random order and in the range 1 to n + 1. For example, an array of length 5 would contain 5 unique integers selected randomly from the integers 1 through 6. Thus, the array might contain 3 6 5 1 4. Of the integers 1 through 6, notice that the 2 was not chosen and is not in the array. Write Java code that finds the integer that does not appear in such an array. Your solution should use a. O(n2) operationsarrow_forward
- Write a Java class that creates a 3x4 array of 12 random ints between 0 and 100. Write a method to return the sum of the elements in the last column of each row in the two-dimensional array.arrow_forwardPlease use Java for the solutionarrow_forwardUsing JAVA, write a method that swaps two rows of a two-dimensional array. The row indices to be swapped are passed as parameters to the method (Assume row indices are valid indices). Write a test program to demonstrate correct operation of the method.arrow_forward
- I need help with creating a Java program described below: Minesweeper.Write a program that reads three numbers, m, n, and p and produces an m-by-n Booleanarray where each element is occupied with probability p. In the minesweeper game, occupiedcells represent bombs and empty cells represent safe cells.Print out the array using an asterisk for bombs and a period for safe cells.Then, create an integer two-dimensional array with the number of neighboring bombs (above,below, left, right, or diagonal). * * . . . * * 1 0 0. . . . . 3 3 2 0 0 . * . . . 1 * 1 0 0Write your code so that you have as few special cases as possible to deal with, by using an(m+2)-by-(n+2) Boolean array.arrow_forwardWrite a Java program that reads an integer N from the user and declares an integer array of size N. It then inputs N non-negative integers from the user into the array and do the following: 1. Finds and prints the minimum, maximum, sum, and average of the numbers. 2. Displays array data as a histogram – graphically by plotting each numeric value as a bar of asterisks (+) as shown in the example diagram. This is somehow similar to Lab11 Sample output Enter the size of array: 9 Enter 9 integer values: 10 19 5 14 Minimum = Maximum = 19 = 68 = 7.55 Sum Average ========== Histogram: ======= Element Ua lue 10 19 Histogran T T T Arial v T = ABC 3 (12pt) II Comarrow_forwardWrite the Java Program to Find the Elements that do Not have Duplicates. Given an array, print all the elements whose frequency is one, that is they do not have duplicates. Example: Array = [-1, -2, 3, 3, -2] Output = -1arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education