Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program will find the median of a set of numbers (the median is the middle number of a set of numbers which are sorted

This program will find the median of a set of numbers (the median is the middle number of a set of numbers which are sorted in ascending or descending sequence; if the number of values in the set is odd, the median is the middle number, but if the number of values is even, the median is the sum of the two middle numbers divided by two).

This program will use function Templates so the set of numbers can be either data type int or double.

In main declare a vector (s) to hold the set of numbers.

The program will have three function Templates:

-Fill_Vector: have the user enter and store an unknown number of numbers into the vector; validate that the numbers are zero or greater (see values below).

-Sort_Vector: sort the vector using the vector sort algorithm.

-Find_Median: determine the median of the numbers in the vector and return the median to main via the function's return type; use vector [] notation (or use vector iterator notation for 5 extra credit points).

Then in main, display the values in the sorted vector (must use iterator) and display the median (all displays to 1 decimal point).

Provide two screen prints with the following values:

1) 25, 4, 13, 1, 0, 9, 17, 29, 11

2) 25.25, 4.4, 1.1, 0.0, 9.9, 17.17, 29.29, -34.34 (should produce error, then enter 11.11)

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

What is something you have never truly wrapped your head around?

Answered: 1 week ago

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago