Write a c++ program to randomly generate


This assignment task is designed to test your understanding of arrays, functions, sorting and searching.
Assignment specification
Write a C++ program to randomly generate, store, sort, search and display the car price (maximum price:K29999) owned by N students at DWU. N should be declared as a constant in your program and it shouldbe equal to 10. You must use a single dimension array to store the car price. Your program should displayand execute a menu with the following options. A switch statement must be used to execute the following
menu options.
1. Initialise all the elements of the array to -99
2. Randomly generate and store the car price for N students
3. Calculate and display the average price of the car owned by N students
4. Find and display the most expensive car
5. Find and display all cars below the average car price
6. Sort and display all car prices in ascending order
7. Search and display array index for a given car price
8. Exit
1. Initialise all the elements of the array to -99
This option initialises all the elements of the array to -99.
2. Randomly generate and store the car price for N students
This option generates the car price for each student using rand() function and stores it in an array. The
random car price must be less than or equal to K29999.
3. Calculate and display the average price of the car owned by N students
This option calculates and displays the average price of the car owned by N students.
4. Find and display the most expensive car
This option finds and displays the most expensive car.
5. Find and display all cars below the average car price
This option finds and displays all cars below the average price.
6. Sort and display all car prices in ascending order
This option sorts and displays all car prices in ascending order. You can use any sorting algorithm
which uses at least two for loops and one if statement.
7. Search and display array index for a given car priceThis option searches and displays array index for a given car price. The program asks the user to enterthe price using the keyboard and searches for it. If the car price entered from the keyboard is foundthen the program displays an array index otherwise it displays an appropriate message.
8. ExitThe program should display the message "Thanks for using this program", your id number and exit.
4
The whole program should work in a loop to enable the user to initialise all the elements of the array to-99, randomly generate and store the car price for N students, calculate and display the average price ofthe car owned by N students, find and display the most expensive car, find and display all cars below theaverage car price, sort and display all car prices in ascending order, search and display array index for agiven car price and exit. 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a c++ program to randomly generate
Reference No:- TGS0145063

Expected delivery within 24 Hours