void findMostAndLeastOccurrence(occurrences, size, highestCountIndex, lowestCountindex); Parameters: occurrences: array of integers size: array size highestCountindex: subscript of array element with the highest occurrence count, passed by reference lowestCountindex: subscript of array element with the lowest occurrence count, passed by reference This function find the number with the most and the number with the least occurrence in the array It does not print anything (no "cout" in here, main function and printCounts function does the printing) int findTotalOccurrenceCount(occurrences, size) Parameters: occurrences: array of integers size: array size Function adds up all the numbers in the occurrences array and returns the total value It does not print anything (no "cout" in here, main function and printCounts function does the printing) The main() function does: Ask user to enter a file name - Open the given file and check for error. If file does not exists, display error message "File XXXXXX not found" and exit program. - Ask user to enter input inputMax - Use an input validation loop to check that inputMax cannot be less than 1. - Define and initialize the array of size inputMax - Open the file as input file - Call the function readNumbersAndTallyOccurrences( ) to read all data and tally the occurrence counts. - Close the file Call the function printCounts() to display the occurrence counts of all numbers from 1 up to inputMax. Call the function findTotalOccurrenceCount() to get the total occurrence count. - Display the total occurrence count. - Call the function findMostAndLeastOccurrence() to find the number with highest and the number with the lowest occurrence count. - Display the number with the highest and the number with the lowest occurrence count Hint: 1. You should store the occurrence count of 1 in the first element (subscript 0) of the frequency array, occurrence count 2 in the second element of array (subscript 1),. 2. Use a simple arithmetic expression to calculate the array subscript from the number that is read from the file only if the number is <= maxlnput. Do not use a gigantic "if" statement to get the array subscript. 3. Remember the rules about array subscript range. 4. There should be only ONE array of size maxlnput (number values are from 1 to certain value > 1) to be defined in main(). The array is passed as a parameter to other functions. 5. You should use function prototypes before main() 6. If there are multiple numbers with the same highest occurrence count or the same lowest occurrence count, use only the first number.
void findMostAndLeastOccurrence(occurrences, size, highestCountIndex, lowestCountindex); Parameters: occurrences: array of integers size: array size highestCountindex: subscript of array element with the highest occurrence count, passed by reference lowestCountindex: subscript of array element with the lowest occurrence count, passed by reference This function find the number with the most and the number with the least occurrence in the array It does not print anything (no "cout" in here, main function and printCounts function does the printing) int findTotalOccurrenceCount(occurrences, size) Parameters: occurrences: array of integers size: array size Function adds up all the numbers in the occurrences array and returns the total value It does not print anything (no "cout" in here, main function and printCounts function does the printing) The main() function does: Ask user to enter a file name - Open the given file and check for error. If file does not exists, display error message "File XXXXXX not found" and exit program. - Ask user to enter input inputMax - Use an input validation loop to check that inputMax cannot be less than 1. - Define and initialize the array of size inputMax - Open the file as input file - Call the function readNumbersAndTallyOccurrences( ) to read all data and tally the occurrence counts. - Close the file Call the function printCounts() to display the occurrence counts of all numbers from 1 up to inputMax. Call the function findTotalOccurrenceCount() to get the total occurrence count. - Display the total occurrence count. - Call the function findMostAndLeastOccurrence() to find the number with highest and the number with the lowest occurrence count. - Display the number with the highest and the number with the lowest occurrence count Hint: 1. You should store the occurrence count of 1 in the first element (subscript 0) of the frequency array, occurrence count 2 in the second element of array (subscript 1),. 2. Use a simple arithmetic expression to calculate the array subscript from the number that is read from the file only if the number is <= maxlnput. Do not use a gigantic "if" statement to get the array subscript. 3. Remember the rules about array subscript range. 4. There should be only ONE array of size maxlnput (number values are from 1 to certain value > 1) to be defined in main(). The array is passed as a parameter to other functions. 5. You should use function prototypes before main() 6. If there are multiple numbers with the same highest occurrence count or the same lowest occurrence count, use only the first number.
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
Related questions
Question
input files are random numbers
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT