Problem Statement You are asked to use a 1D array to store a set of random values. Your program should contain the following functions: • Set function to set array's elements with random values between two given values inclusive. For example, for an array of 5 elements filled with random values between 2 and 12 inclusive, the array will look like: 8 12 3 9 12 • Get function to output array's elements. For example, for 8 12 3 9 12, your function should print [8 - 12-3-9-12). • GetAvg function to return the average of random values stored in the array. • Shift function to shift to the left the array's elements by a given step. For example, o For the original array of 8 12 3 9 12 and for a step = 1, the new array after calling Shift function will be 12 3 9 12 8. o For the original array of 8 12 3 9 12 and for a step = 2, the new array after calling Shift function will be 3 9 12 8 12. • Sort function to sort in ascending order the array's elements. For example, for the original array of 8 12 3 9 12, the new array after calling Sort function will be 3 89 12 12. Several sorting algorithms exist to sort a 1D array (Selection Sort, Bubble Sort, Quick Sort.). You are asked to solve the sorting function using Selection Sort and Bubble Sort algorithms. • Main function to test your program on an array of 5 elements as given in the sample of input/output below. • Convert your program to create dynamically the array (i.e., array's length is set by the user). Sample of input/output Press 1 to Set, 2 to Get, 3 to Get Avg, 4 to Shift, 5 to Sort, -1 to End Your Choice? 15 Invalid Choice! Try Again Your Choice? 1 Enter first value: 2 Enter second value: 12 Setting Done Successfully!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
12:10
Done CosC 214 Project_460ea87bc98e...
Problem Statement
You are asked to use a 1D array to store a set of random values. Your program should
contain the following functions:
• Set function to set array's elements with random values between two given
values inclusive. For example, for an array of 5 elements filled with random
values between 2 and 12 inclusive, the array will look like:
8 12 3 9 12
• Get function to output array's elements. For example, for 8 12 3 9 12, your
function should print [8 – 12 - 3-9 – 12].
GetAvg function to return the average of random values stored in the array.
• Shift function to shift to the left the array's elements by a given step.
For example,
o For the original array of 8 12 3 9 12 and for a step = 1, the new array
after calling Shift function will be 12 3 9 12 8.
o For the original array of 8 12 3 9 12 and for a step = 2, the new array
after calling Shift function will be 3 9 12 8 12.
Sort function to sort in ascending order the array's elements. For example, for the
original array of 8 12 3 9 12, the new array after calling Sort function will be 3
8 9 12 12.
Several sorting algorithms exist to sort a 1D array (Selection Sort, Bubble Sort,
Quick Sort.). You are asked to solve the sorting function using Selection Sort and
Bubble Sort algorithms.
Main function to test your program on an array of 5 elements as given in the
sample of input/output below.
• Convert your program to create dynamically the array (i.e., array's length is set by
the user).
Sample of input/output
Press 1 to Set, 2 to Get, 3 to Get Avg, 4 to Shift, 5 to Sort, -1 to End
Your Choice? 15
Invalid Choice! Try Again
Your Choice? 1
Enter first value: 2
Enter second value: 12
Setting Done Successfully!
||Rafik Hariri University
جامعة رفيق الحريری U=
Affordable Excellence in Education
Your Choice? 2
Array values are:
[8 - 12 -3-9-12]
Your Choice? 3
Average is 8.8
Your Choice? 4
Enter step: 2
Shifting Done Successfully!
Your Choice? 2
Array values are:
(3 -9-12 -8- 12)
Your Choice? 5
Sorting Done Successfully!
Your Choice? 2
Array values are:
(3 -8 -9- 12 -12]
Your Choice? -1
Thank You!
Transcribed Image Text:12:10 Done CosC 214 Project_460ea87bc98e... Problem Statement You are asked to use a 1D array to store a set of random values. Your program should contain the following functions: • Set function to set array's elements with random values between two given values inclusive. For example, for an array of 5 elements filled with random values between 2 and 12 inclusive, the array will look like: 8 12 3 9 12 • Get function to output array's elements. For example, for 8 12 3 9 12, your function should print [8 – 12 - 3-9 – 12]. GetAvg function to return the average of random values stored in the array. • Shift function to shift to the left the array's elements by a given step. For example, o For the original array of 8 12 3 9 12 and for a step = 1, the new array after calling Shift function will be 12 3 9 12 8. o For the original array of 8 12 3 9 12 and for a step = 2, the new array after calling Shift function will be 3 9 12 8 12. Sort function to sort in ascending order the array's elements. For example, for the original array of 8 12 3 9 12, the new array after calling Sort function will be 3 8 9 12 12. Several sorting algorithms exist to sort a 1D array (Selection Sort, Bubble Sort, Quick Sort.). You are asked to solve the sorting function using Selection Sort and Bubble Sort algorithms. Main function to test your program on an array of 5 elements as given in the sample of input/output below. • Convert your program to create dynamically the array (i.e., array's length is set by the user). Sample of input/output Press 1 to Set, 2 to Get, 3 to Get Avg, 4 to Shift, 5 to Sort, -1 to End Your Choice? 15 Invalid Choice! Try Again Your Choice? 1 Enter first value: 2 Enter second value: 12 Setting Done Successfully! ||Rafik Hariri University جامعة رفيق الحريری U= Affordable Excellence in Education Your Choice? 2 Array values are: [8 - 12 -3-9-12] Your Choice? 3 Average is 8.8 Your Choice? 4 Enter step: 2 Shifting Done Successfully! Your Choice? 2 Array values are: (3 -9-12 -8- 12) Your Choice? 5 Sorting Done Successfully! Your Choice? 2 Array values are: (3 -8 -9- 12 -12] Your Choice? -1 Thank You!
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY