Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem Write a C program to keep records and perform statistical analysis for a car sales agency. The information of each car contains the type
Problem Write a C program to keep records and perform statistical analysis for a car sales agency. The information of each car contains the type of the vehicle, engine size, mileage, year, and price. Note that you cannot use while loops in the program. Program should accept information about 4 cars. We consider the program with two-dimensional array "database", where each row is an individual car, while columns represent parameters of a vehicle. 1) Function O_Car_Discount_4 that takes mileage, year and price as an argument and returns adjusted price of a car after applying discounts as per the below table. (25 points) Sample output: *** CAILA CAR SALES ALENCY DATABASE *** ELCOME TO SYSTEM Please enter body type, engine tine, lenge, year, and price of the car #1 >> 10 2.4 10 20 Pease enter body type, engine tizenlenge, year, and price of the car #2 > 20 3.0 10000 22e se Please enter body type, engine size, longe, year, and price of the car 3 >> 18 4.5 50000 2001 2000 Wrong vehicic type, please try again! Please enter body type, engine size, lege, year, and price of the car t3 39 4.5 589 2311 4899 Please enter body type, engine size, niloage, year, and price of the car #4 > 28 4.8 32ese 21 18e >>>>> The last wilson lot 2000 m >>The cheapest car en let: 190 KD >>The oldest car on lot is year 2001 >>>>> =100,000km =2010 and 2015 3% 10% TOR 1 2 3 Year Price 2005 388 KD 2620 800 KD 2011 me k 2e91 1eee 2) Function O_Print_Car_4 that accepts a row of a "database" array. Function must call O_Car_Discount_4 to calculate discounted price of a car. Function must print vehicle engine size, mileage, price and discounted price as per sample output. Function must convert vehicle type to user-friendly format per table below (25 points): Vehicle Type Displayed Text 10 Hatchback 20 Sedan 30 SUV 40 Minivan >>>>> Please, enter ID of a car to vien (or 999 to exit): 1 Car Info: 2005 Hatchback Erwin size 2.4L www: 10 Original Price D. Discounted price: 2400D Pense, enter ID of car to view (ar 999 ta exit): 5 Anong inputt Please, try again! 3) O_Lot_info_4 that takes "database array and prints out (25 points): The lowest mileage car. The cheapest car The oldest cur Picase, enter ID of a car to view (or 999 to exit): 3 Car info: 2011 SUV Engine size 4 SL Cle: 5 KM wiginal Price: 48eKD. Discounted price: 38BKD Pass, enter of car to view (er 19 ta exit): 1999 Student rase: Abdullah Abdullah, TO: 12345, Section: 01 4) Main function should perform the following tasks. (25 points) Read the type of vehicle, engine size, mileage, year, and price from the user and stores it in "database array, Prints list of cars from "database" with ID, year and price as per sample output. Ask the user which car he/she wants to see and call O_Print_Car_4 with respective row. If user inputs 999, exit the program Calls O_Lot_info_4 as shown in the sample output. Shows student information as per sample output. Page 2 of 3 Page 3 of 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started