Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ please do all the requirements for this assignment Thank you. Arrays store dala contiguously by representing data with a common name and dislinguishing

in c++
please do all the requirements for this assignment
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 contiguously by representing data with a common name and dislinguishing if 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! c-Array Indices Array Leneth =9 First 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 [1, 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 1ist [], 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 Virainia 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 i=1 to count 1 /* set current element as minimumt/ min =1 /*go through the 118t and find the malleat element*/ for j=1+1 to count if list [j] min=j; end if end for /* swap the minimum element with the current element If they are not the same element* if indexMin !=1 then swap list [min] and list [i] end if end for 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! I 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.cpp 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: ): 2256773 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 Stac1st1cs program

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

Students also viewed these Databases questions

Question

LOQ 5-23: How does our well-being change across the life span?

Answered: 1 week ago

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago