a. Compute the median of a data file. The median is the number that has the same number of data elements greater than the number as there are less than the number. For purposes of this problem, you are to assume that the data is sorted (that is, is in increasing order). The median is the middle element of the file if there are an odd number of elements, or the average of the two middle elements if the file has an even number of elements. You will need to open the file, count the elements, close the file and calculate the location of the middle of the file, open the file again (recall the “start over” discussion in this chapter), count up to the file entries you need, and calculate the middle.
If your instructor has assigned this problem, ask for a data file to test your
b. For a sorted file, a quartile is one of three numbers: The first has one-fourth the data values less than or equal to it, one-fourth the data values between the first and second numbers, one-fourth the data points between the second and the third, and one-fourth above the third quartile. Find the three quartiles for the data file you used for part (a).
(Hint: You should recognize that having done part (a) you have one third of your job done—you have the second quartile already. You also should recognize that you have done almost all the work toward finding the other two quartiles as well.)
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting out with Visual C# (4th Edition)
C How to Program (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
- Please design the mapper and reducer for the below WordCount problem. WordCount problem: Given an input text file, count the frequency of each word in the file. Please design the input and output pairs for the Mapper and Reducer, use below table for reference. Input Output We get the "WordCount.jar" file by using the above table. It only contains Mapper and Reducer. There is no Combiner and no Partitioner in this program. Please illustrate how the WordCount.jar program works on the below dataset. This text file only contains one line. Dataset: the sound sounds sound. it is the right right, right? Suppose we run the WordCount.jar program on this file. Suppose that the space symbol, and "?" are all used for separating the words. The outputs of the Mapper are Mapper The outputs of the reducer are Reducer Answer: Are the results sorted alphabetically? When was it sorted? 2 27 20 35arrow_forwardProblem:A company has stock of many goods, and they want to filter the stock so that some of the materials can go on sale. The stock information recorded in a file"data.txt" as shown in the sample. (in the following sequence)(item name, price_perunit, profit, months_of_stocking, customer_reviews )The sale policy of the company depends on many factors according to the following. • if item in stock more than 8 months and item profit is more than average profit of all items o yes - if customer reviews low quality ● yes – sale 50% ● no – if customer reviews medium quality o yes – sale 30% o no – sale 15% o no- if item profit more than 8% of the item price ● Yes – if in stock more than 1 year o yes-sale 40% o no- not on sale ● No - not on sale Write a C++ program that reads the information from “data.txt” input file into 5 arrays, then processes these arrays to produce three arrays, first array holds the items on sale, second array holds percentage of sale , and the third one holds the…arrow_forwardGiven a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into four separate arrays, and outputs the available food items in the following format: name (category) -- description Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character. Ex: If the input of the program is: food.txt and the contents of food.txt are: Sandwiches Ham sandwich Classic ham sandwich Available Sandwiches Chicken salad sandwich Chicken salad sandwich Not available Sandwiches Cheeseburger Classic cheeseburger Not available Salads Caesar salad Chunks of romaine heart lettuce dressed with lemon juice Available Salads Asian salad Mixed greens with ginger dressing, sprinkled with sesame Not available Drinks Water…arrow_forward
- Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into four separate arrays, and outputs the available food items in the following format: name (category) -- description Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character. Ex: If the input of the program is: food.txt and the contents of food.txt are: Sandwiches Ham sandwich Classic ham sandwich Available Sandwiches Chicken salad sandwich Chicken salad sandwich Not available Sandwiches Cheeseburger Classic cheeseburger Not available Salads Caesar salad Chunks of romaine heart lettuce dressed with lemon juice Available Salads Asian salad Mixed greens with ginger dressing, sprinkled with sesame Not available Drinks Water…arrow_forwardUse C++arrow_forwardWrite R programing to perform the following: Q1 Read voter.xlsx file and store all data in a data frame. a. Using filter function, find all female voters whose age is between 30 and 40 (both inclusive). b. Using filter function, find all voters whose district code and zip code are odd numbers. c. Using filter and arrange functions, sort all voters in 77002 by age in descending order. d. Using filter, arrange, and select functions, sort all male voters by name in ascending order and display only their names, voter IDs, and ages. e. Using filter and select functions, display only the name and gender of the voters whose district ID is less than 10 and zip code is greater than 77010. f. Using mutate function, add Voting Day column by getting the remainder of District ID divided by 7 and adding 1 to the remainder. Therefore, voting day of each voter will be a number from 1 to 7. For instance, the voting day of Heather will be 2 since her district ID is 92 and the remainder of 92/7 is 1. g.…arrow_forward
- Write a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…arrow_forwardWrite a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…arrow_forward*Student information is being held in a data area, where each student record has the following format: The first nine bytes are the student number, held in ASCII The next byte is the course mark The next word is the section identifier 10009. There are well over three hundred such student records that have been loaded sequentially into memory starting at address $10000. The last record loaded is a dummy record with a section identifier of $FFFF, to show the end of the rècords. If a2 has the address of a student record, what is the location of the next record in the array / data area. Explain your answer.arrow_forward
- Write a Program in C Language.arrow_forwardWrite the program that allows the user to sort using the Bubble Sort, Selection Sort, Insertion Sort and Shell Short The program should be able to read in data from a binary file. The first element of the binary file will be used to tell how many elements to read in. Once all the data has been read in, the program should sort the data. The user should be able to choose which algorithm to use to sort the data. The program should print the time before and after the sort - be sure to not print the start time until after the algorithm has been chosen from your menue. The last part of the program should print out the value and location of three random positions in your array The name of each algorithm:Insertion Sort A description of the elapsed time found for each input file: 10numbers; 12 seconds 100number: 30 seconds ... A screenshot of the output of your program showing the start time and stop time of each algorithm running on the largest file (1000000numbers) as well as the…arrow_forward3. Laramie Park District has files of participants in its summer and winter programs this year. Each file is in participant ID number order and contains additional fields for first name, last name, age, and class taken (for example, Beginning Swimming). a. Design the logic for a program that merges the files for summer and winter programs to create a list of the first and last names of all participants for the year in ID number order. b. Modify the program so that if a participant has more than one record, the participant's ID number and name are output only once. c. Modify the program so that if a participant has more than one record, the ID number and name are output only once along with a count of the total number of classes the participant has taken.arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT