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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.3: Pointer Arithmetic
Problem 3E
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,