About this Project This project will allow you to use arrays and perform a series of tasks on those arrays. It will require your knowledge in arrays and functions.

Requirements

Write a menu-driven program that allows the user to fill an array, query the array, and print the array. The menu and an explanation of each option is shown below.

MENU
Select one of the following options:
F. Fill the array with a random number series.
P. Print the array.
Q. Query the array.
Z. Terminate the program.

Some notes:

  • The fill option will fill an array of 50 integers with random numbers in the range 1999. Each time the fill option is executed, it will fill the array with a new random number series.
  • Print the array will print the numbers to the screen, in whatever format you deem appropriate.
  • Query will ask the user to enter a location (index), and will then print the number in that location. If the user enters an invalid location, it will print a message stating so.
  • You must use functions to perform each of the tasks on the menu.

Test Cases

A series of test cases will be used to grade your computer program. The following sequence of steps will be performed:

  • Fill (F) the array.
  • Print (P) the array. We should see an array filled with random numbers 0-999.
  • Query (Q) the array for the first, middle, and last element. Those elements should match what we saw when we printed the array.
  • Refill (F) the array.
  • Print (P) the array. We should see an array with different random numbers than those in step 2.
  • Query (Q) the array for the first, middle, and last element. Those elements should match what we saw in step 5.
  • Terminate (Z) the program.

Extra Credit Opportunity

There are two opportunities for extra credit as part of this project. They are not required for full credit. Each opportunity will be graded independently (meaning, you can perform neither, one, or both of the extra credit tasks).

Extra Credit 1

Add a S. Search the Array function to your program that will allow the user to determine if a specific number is found somewhere in the array. When the search option is chosen, the program will ask the user what number to search for. If the search locates the number, it will print a message that the number was located and the index location where it was found. Note that the number may be found more than once in the array, and the search option must find all instances of the number. If the number is not found, a message must be displayed to the screen with that information.

Extra Credit 2

Add a O. Sort the Array function to your program that will allow the user to sort the array from smallest to greatest (in other words, the smallest of the random numbers will be in index 0, 1, 2, , and the largest random numbers will be index 48, 49, 50). See the resources provided with this project that may be used as your sorting feature.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.