How would I match the sample in code? The original and new array are printed out in rows of six integers.   Sample#1 Please enter the size of array:7 Please enter an integer:3 Please enter an integer:4 Please enter an integer:8 Please enter an integer:11 Please enter an integer:8 Please enter an integer:3 Please enter an integer:3 Here is a printout of the original array:    3   4   8  11   8   3    3 The sum of all the elements in the array is: 40 The average of all the elements in the array is: 5.71 The max of all the elements in the array is 11 The min of all the elements in the array is: 3 What value you would like to be removed:8 The number of occurrences of 8 in the array is: 2 Here is a printout of the new array with number 8 removed:    3   4  11   3   3 Sample#2 Please enter the size of array:9 Please enter an integer:3 Please enter an integer:4 Please enter an integer:89 Please enter an integer:-10 Please enter an integer:78 Please enter an integer:16 Please enter an integer:85 Please enter an integer:100 Please enter an integer:0 Here is a printout of the original array:    3   4  89 -10  78  16   85 100   0 The sum of all the elements in the array is: 365 The average of all the elements in the array is: 40.56 The max of all the elements in the array is 100 The min of all the elements in the array is: -10 What value you would like to be removed:1 The number of occurrences of 1 in the array is: 0 Here is a printout of the new array with number 1 removed:    3   4  89 -10  78  16   85 100   0 Sample#3 Please enter the size of array:25 Please enter an integer:42 Please enter an integer:21 Please enter an integer:24 Please enter an integer:0 Please enter an integer:93 Please enter an integer:17 Please enter an integer:34 Please enter an integer:2 Please enter an integer:38 Please enter an integer:35 Please enter an integer:29 Please enter an integer:2 Please enter an integer:73 Please enter an integer:1 Please enter an integer:1 Please enter an integer:74 Please enter an integer:3 Please enter an integer:39 Please enter an integer:2 Please enter an integer:40 Please enter an integer:41 Please enter an integer:58 Please enter an integer:58 Please enter an integer:59 Please enter an integer:61 Here is a printout of the original array:   42  21  24   0  93  17   34   2  38  35  29   2   73   1   1  74   3  39    2  40  41  58  58  59   61 The sum of all the elements in the array is: 847 The average of all the elements in the array is: 33.88 The max of all the elements in the array is 93 The min of all the elements in the array is: 0 What value you would like to be removed:1 The number of occurrences of 1 in the array is: 2 Here is a printout of the new array with number 1 removed:   42  21  24   0  93  17   34   2  38  35  29   2   73  74   3  39   2  40   41  58  58  59  61

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

How would I match the sample in code? The original and new array are printed out in rows of six integers.

 

Sample#1

Please enter the size of array:7
Please enter an integer:3
Please enter an integer:4
Please enter an integer:8
Please enter an integer:11
Please enter an integer:8
Please enter an integer:3
Please enter an integer:3
Here is a printout of the original array:
   3   4   8  11   8   3
   3
The sum of all the elements in the array is: 40
The average of all the elements in the array is: 5.71
The max of all the elements in the array is 11
The min of all the elements in the array is: 3

What value you would like to be removed:8
The number of occurrences of 8 in the array is: 2

Here is a printout of the new array with number 8 removed:
   3   4  11   3   3

Sample#2

Please enter the size of array:9
Please enter an integer:3
Please enter an integer:4
Please enter an integer:89
Please enter an integer:-10
Please enter an integer:78
Please enter an integer:16
Please enter an integer:85
Please enter an integer:100
Please enter an integer:0
Here is a printout of the original array:
   3   4  89 -10  78  16
  85 100   0
The sum of all the elements in the array is: 365
The average of all the elements in the array is: 40.56
The max of all the elements in the array is 100
The min of all the elements in the array is: -10

What value you would like to be removed:1
The number of occurrences of 1 in the array is: 0

Here is a printout of the new array with number 1 removed:
   3   4  89 -10  78  16
  85 100   0

Sample#3

Please enter the size of array:25
Please enter an integer:42
Please enter an integer:21
Please enter an integer:24
Please enter an integer:0
Please enter an integer:93
Please enter an integer:17
Please enter an integer:34
Please enter an integer:2
Please enter an integer:38
Please enter an integer:35
Please enter an integer:29
Please enter an integer:2
Please enter an integer:73
Please enter an integer:1
Please enter an integer:1
Please enter an integer:74
Please enter an integer:3
Please enter an integer:39
Please enter an integer:2
Please enter an integer:40
Please enter an integer:41
Please enter an integer:58
Please enter an integer:58
Please enter an integer:59
Please enter an integer:61
Here is a printout of the original array:
  42  21  24   0  93  17
  34   2  38  35  29   2
  73   1   1  74   3  39
   2  40  41  58  58  59
  61
The sum of all the elements in the array is: 847
The average of all the elements in the array is: 33.88
The max of all the elements in the array is 93
The min of all the elements in the array is: 0

What value you would like to be removed:1
The number of occurrences of 1 in the array is: 2

Here is a printout of the new array with number 1 removed:
  42  21  24   0  93  17
  34   2  38  35  29   2
  73  74   3  39   2  40
  41  58  58  59  61

 

 

Assignment:
Write a Java program named NumberArray with the following tasks:
Prompt user to enter the number of data values
Prompt user to enter each data value
o Must fill each value into an array with the exact size
Printout the array with specified format by invoking method, printArray()
printArray() must have an array as argument
printArray() must print out 6 numbers per row with specified format
(see sample for details)
●
Transcribed Image Text:Assignment: Write a Java program named NumberArray with the following tasks: Prompt user to enter the number of data values Prompt user to enter each data value o Must fill each value into an array with the exact size Printout the array with specified format by invoking method, printArray() printArray() must have an array as argument printArray() must print out 6 numbers per row with specified format (see sample for details) ●
Purpose of this assignment:
Using methods
Using loops
Using Array
Using conditional statements
●
●
●
Assignment:
Write a Java program named NumberArray with the following tasks:
Prompt user to enter the number of data values
Prompt user to enter each data value
o Must fill each value into an array with the exact size
• Printout the array with specified format by invoking method, printArray()
printArray() must have an array as argument
printArray() must print out 6 numbers per row with specified format
(see sample for details)
Printout the sum of all elements in the array by invoking method,
getTotal()
●
●
●
●
●
O
O
getTotal() must have an array as argument and return the sum
Printout the average of all elements in the array by invoking method,
getAverage()
O
getAverage() must have an array as argument and return the average
(as double)
Printout the maximum number of all elements in the array by invoking
method, getHighest()
O
O
getHighest() must have an array as argument and return the highest
value of the array
Transcribed Image Text:Purpose of this assignment: Using methods Using loops Using Array Using conditional statements ● ● ● Assignment: Write a Java program named NumberArray with the following tasks: Prompt user to enter the number of data values Prompt user to enter each data value o Must fill each value into an array with the exact size • Printout the array with specified format by invoking method, printArray() printArray() must have an array as argument printArray() must print out 6 numbers per row with specified format (see sample for details) Printout the sum of all elements in the array by invoking method, getTotal() ● ● ● ● ● O O getTotal() must have an array as argument and return the sum Printout the average of all elements in the array by invoking method, getAverage() O getAverage() must have an array as argument and return the average (as double) Printout the maximum number of all elements in the array by invoking method, getHighest() O O getHighest() must have an array as argument and return the highest value of the array
Expert Solution
steps

Step by step

Solved in 5 steps with 7 images

Blurred answer
Knowledge Booster
Array
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.
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