Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please do all the requirements and data validation too Thank you. Arrays store dala conliguously by representing data with a common name and dislinguishing it

please do all the requirements and data validation too
Thank you. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Arrays store dala conliguously by representing data with a common name and dislinguishing it by its index. This is like a parking garage: the garage stores vehicles; all parking spaces have a common name (the name of the garage), and a specific parking space number identifies each parked vehicle. This is also true of arrays. Think of arrays as parking garages for our data! K-Array Indices Array Length =9 Firat Index =0 Last Index =8 Purpose In this assignment, you will be writing a program that stores a list of positive integers from input into an array and calculates the minimum, maximum, mean, median, mode, and whether the array is a palindrome. A negative integer indicates the end of the input and is not stored in the array. I the main () function to accomplish this Task. void readinput (int list [], int \&count); Reads a list of posilive integers from the user. A negative integer indicates the end of the input and is not stored in the array. (Use an appropriate looplI) void maxmin (int list [], int count, int smax, int smin); Use a loop to process each array element and return the minimum and maximum values to main by reference. These values should be printed in main (). double avgArray (int list [], int count) ; Use a loop to sum all the array elements and calculate the mean (or average). Return the mean to main () and in main () print the average with one decimal place using cout fixed setprecision (1): bool isPalindrome (int list [], int count); Use a loop to determine if the array is a palindrome, meaning values are the same from front to back and back to front. Output "true" or "false". void sort (int list [], int count); Sort the array using the given sorting algorithm. This is called Selection Sort. Use only this algorithm to sort your list. To see how the Selection Card Sort Algorithm works, watch this video from Virqinia Tech. Watch this Python Video to help you with the sorting algorithm. Try this Selection Sort Animation by Y. Daniel Liang. procedure selection sort list : array of items count : size of list for 1=1 to count 1 ; set current element as minimum* 1 min = ; ho through the ligt and find the smalleat element* for j=1+1 to count if list[j]l swap the minimum element with the current element If they are not the same element* / if indexMin !=i then gwap list [min] and list [i] double median(int list [], int count); After sorting, write this function to identify the median. The median is located in the middle of the array if the array's size is odd. Otherwise, the median is the average of the middle two values. Return the median to main () and output in main () with one decimal place. Extra!! Extra!!! No grade associated with this extra - but by doing this extra function you will know that you have truly set your bar high to practice more with arrays!! a. Challenge! Identify the mode after the array is sorted in ascending order. The mode is the value that appears most frequently. Assume only one mode exists. Hint: Use a loop to process each array element, looking for the longest sequence of identical values. Remember the list is sorted - that means it is slightly easier to find the mode. Assume the array will always contain fewer than 20 integers. You must not let the user enter more than 20 integers. Your program must have function prototypes. Place the prototypes for your functions globally, after your \#includes. All functions must be implemented after main() and follow above mentioned requirements. You may not use a while true loop and break statements in the loop. Your program must check for valid input data. Use loops to repeat until you get valid data from the user. Check out the sampleA01.cop that has a readint function that can be used to check for valid data. You can call this function to read integers for the array. Try not to have any redundant code (repeated code) in your program. That is the purpose of functions. Use constants where appropriate, for example - the capacity of the array. Do not use vectors for this program. Use only the concepts and functions we have learned so far. Welcome to my Array Statistics program! Please enter the values for the array (negative number to end input:) : 22566773 Your stats are as below: Minimum: 2 Maximum: 7 Mean: 4.8 Palindrome: false Median: 5.5 Thank you for using my Array Statistics program!! Welcome to my Array Statistics program! Please enter the values for the array (negative number to end input: ): 1234543216 Your stats are as below: Minimum: 1 Maximum: 5 Mean: 2.8 Palindrome: true Median: 3 Thank you for using my Array Statist1cs programs

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions