Intro to Programming Lab 4 Vehicles Sold – Arrays
Create a C# console application following the requirements below to allow the user to enter the number of vehicles sold at a dealer for each of day of one week (seven days in total). The program should then determine the average, highest and lowest daily number of vehicles sold and display a formatted report. The user should then have the option to repeat the sequence for another week if they so choose.
• When the program starts the user is prompted for the number of units sold on ‘day 1’.
• Accept the number of vehicles sold amount from the user. Vehicles cannot be sold in fractions. Typically, this dealer sells between 2 to 12 vehicles in a day, but some days it might be as high as 20. Selling 50 or more vehicles in a day would be considered unreasonable, and should be treated as a data entry error.
• If the user entry is non-numeric, outside of the acceptable range, or not a whole number, the program should display an appropriate error message and re-prompt for that day’s sales amount.
• Once the user input passes all validation, store the number of vehicles sold in an array large enough to hold the seven amounts to be entered.
• The steps outlined above will all have to repeat (iterative structure required) to allow the entry of good amounts for seven days. Refer to the sample output on the next page to help guide you in your planning.
• Once seven days’ worth of vehicles sold amounts have been entered and stored in your array, you can then go ahead and process the array to calculate the average daily vehicles sold rounded to the nearest whole number, as well as determine the days that the highest and lowest vehicles sold amounts occurred.
• NOTE: Although C# includes a number of method(s) as part of the Array Class, many languages do not. For this lab you may not use any of the Array Class’s built-in methods to obtain the average, highest or lowest amounts. You are expected to determine these values using a processing loop.
• After processing, clear the screen and then produce output to match the screenshots supplied. Display the original daily units sold amounts as shown, followed by the average number of vehicles sold, and the days that the highest and lowest number of vehicles were sold.
• Display a prompt to the user asking if they would like to process another week of vehicle sales for average calculation and high/low determination. If the user elects to enter another week, clear the screen and repeat the entire process again beginning with a prompt to enter a score for day 1; otherwise end the application with no further notification.