Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 08A Modify the selectionSort function presented in chapter 8 so it sorts an array of strings instead of an array of ints. - You'll

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Homework 08A Modify the selectionSort function presented in chapter 8 so it sorts an array of strings instead of an array of ints. - You'll also want to modify the showArray function to accommodate strings. - Test the function with a driver program. Use Program 8-8, shown below, as a skeleton to complete. ' Be sure to place your name at the top to indicate whose String Sorter this is. Call your program YourName-erk8A.cpp . // Program 8-8: #include #include Homework using namespace std; 08A int main() // Define an array with unsorted values const int SIZE = 20; string names[SIZE] = {"Collins, Bill", "Smith, Bart", "Allen, Jim", "Griffin, Jim", "Stamey, Marty", "Rose, Geri", "Taylor, Terri", "Johnson, Jill", "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", "James, Jean", "Weaver, Jim", "Pore, Bob", "Rutherford, Greg", "Javens, Renee", "Harrison, Rose", "Setzer, Cathy", "Pike, Gordon", "Holland, Beth"}; // Insert your code to complete this program return 0;Homework 088 Find the Median You are given a file with a list of grades. You are asked to find the Median grade for the class. - Definition of Median: If an array of numbers is sorted in ascending order, then the median number would be the number in the middle. 0 For example, given the numbers: {92, 13, 54, 72, 87}, the median number would be 72. This is easier to see if you arrange the numbers in ascending order: ' {13, 54, 72, 87, 92}. As you can see, when arranged in order, the number 72 is clearly in the middle. Homework 088 Definition of Median Cont. - If the number of numbers is even (not odd as shown above), then the average of the two numbers in the middle defines the Median. For example, suppose we had six numbers, instead of 5. Arranging them in order we might see: {13, 54, 72, 74, 87, 92}. - In this case, both 72 and 74 are in the middle. The average ofthese two number is 73. - Therefore, the Median of these 6 numbers is 73. Homework 088 Find the Median You will be given two files, GradeList1.txt and GradeList2.txt. - Write a program that will determine the median grade in GradeList for either of these two cases (one has an Odd number of grades and the other has an Even number of grades). Your program should detect whether the number of integers is even or odd. - lfthe number is odd, your program should use the algorithm that determines the median of a sequence having an odd number of elements. - lfthe number turns out to be even, your program should use the algorithm that determines the median of a sequence having an even number of elements. You may use either a Bubble Sort or a Selection Sort in implementing this program. Likewise, you may use either arrays or vectors to in doing this computation. Be sure to identify whose Median Calculator this is (i.e. your name in the title). Call your program: YourName-erk83.cpp

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

PM develops the capacity of people to meet and exceed __________

Answered: 1 week ago