QuestionQuestion

Write a program that prompts the user for the prices of 10 automobiles (use looping to do this and store the prices in an array). The automobiles may be priced from less than $1 up to $99,999. No negative numbers are allowed. Perform error checking to ensure that only valid numbers are entered ($1 - $99,999). Using a function, calculate and display the number of cars in all 10 price categories, i.e., $1 - $9999, $10,000 - $19,999, $20-000 - $29,999, … $90,000 - $99,999. Call a function that loops through the array, and displays the highest and lowest priced cars only. Call a separate function which calculates the average of all of the cars, and passes the average amount back to the main() function, where it is printed out.

Sample Session:

Please enter the price of Automobile #1: 25999
Please enter the price of Automobile #2: 15000
Please enter the price of Automobile #3: 45000
Please enter the price of Automobile #4: 65000
Please enter the price of Automobile #5: 2999
Please enter the price of Automobile #6: 33000
Please enter the price of Automobile #7: 82000
Please enter the price of Automobile #8: 41000
Please enter the price of Automobile #9: 24000
Please enter the price of Automobile #10: 19999

The number of cars in the $1 - $9999 range is: 1
The number of cars in the $10000 - $19999 range is: 2
The number of cars in the $20000 - $29999 range is: 2
The number of cars in the $30000 - $39999 range is: 1
The number of cars in the $40000 - $49999 range is: 2
The number of cars in the $50000 - $59999 range is: 0
The number of cars in the $60000 - $69999 range is: 1
The number of cars in the $70000 - $79999 range is: 0
The number of cars in the $80000 - $89999 range is: 1
The number of cars in the $90000 - $99999 range is: 0
The highest priced car is: $82000
The lowest priced car is: $2999
The average price of all the cars is: $35400 (round to the nearest dollar).

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

// prototype
void CarNumberCalculation(const int price[], int size);
void DisplayPrice(const int price[], int size);
int AveragePrice(const int price[], int size);

int main(int argc, char** argv) {
   
    int price[10];
    int p ;
    /*
    * prompts the user for the prices of 10 automobiles
    * (use looping to do this and store the prices in an array).
    * The automobiles may be priced from less than $1
    * up to $99,999.
    */
    for (int i = 1; i <= 10; i++) {...
$25.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats