Chat with us, powered by LiveChat Write a program to find the top 10 cars with highest city mpg. - Wridemy

Write a program to find the top 10 cars with highest city mpg.

I’m working on a c programming project and need a sample draft to help me learn.

 

You are given a dataset about some all-wheel-drive cars and how much fuel they use. This data file is a subset of a public available CSV file: https://corgis-edu.github.io/corgis/csv/cars/.” you can download the input file from here”. It allows consumers to directly compare cars.

Write a program to find the top 10 cars with highest city mpg. Write the results in the output file. The input file is a CSV file with the following fields for each car: Identification (String), Classification (String), Engine Type (String), Transmission (String), City mpg(Integer), Fuel Type (String), Highway mpg(integer). Fields are separated by comma, with each car on a separate line:

2009 Audi A4 Sedan 3.2, Automatic transmission, Audi 3.2L 6 cylinder 265hp 243ft-lbs, 6 Speed Automatic Select Shift, 17, Gasoline, 26

….

Classification: whether this is a “Manual transmission” or an “Automatic transmission”. If it is unknown, it is left blank.Identification: a unique ID for this particular car, using the year, make, model, and transmission type.

Example input/output:

Enter the file name: cars.csv

Output file name:

Top10_city_mpg.csv

Technical requirement:

1. Name your program cars_mpg.c.

2. The output files should be the named Top10_city_mpg.csv.

3. Assume that there are no more than 6000 cars in the file. Assume that each field is no more

than 150 characters.

4. Use fscanf and fprintf to read and write data. To read all fields of a car, use the following

conversion specifier for fscanf:

“%[^,], %[^,], %[^,], %[^,], %d, %[^,], %dn”

5. The program should be built around an array of car structures, with each car containing

information of engine type, transmission, city mpg, fuel type, highway mpg, classification,

and identification.

6. Your program should include a function that sorts the cars by city mpg. You can use any

sorting algorithms such as selection sort and insertion sort. Note that with different sorting

algorithms, the result might differ when city mpg are the same.

void sort_city_mpg(struct car list[], int n);

7. Output file should be in the same format as the input file, with the members separated by

comma and each car on a separate line.

2012 Subaru Impreza Hatchback 2.0i, Manual transmission, Subaru 2.0L 4 Cylinder 148 hp 145 ft-lbs, 5 Speed Manual, 25,

Gasoline, 34

…..

Programming Style Guidelines

1. Your program should begin with a comment that briefly summarizes what it does.

2. In most cases, a function should have a brief comment above its definition describing what it

does. Other than that, comments should be written only needed in order for a reader to

understand what is happening.

3. Information to include in the comment for a function: name of the function, purpose of the

function, meaning of each parameter, description of return value (if any), description of side

effects (if any, such as modifying external variables)

4. Variable names and function names should be sufficiently descriptive that a knowledgeable

the reader can easily understand what the variable means and what the function does. If this is not

possible, comments should be added to make the meaning clear.

5. Use consistent indentation to emphasize block structure.

6. Full line comments inside function bodies should conform to the indentation of the code where

they appear.

7. Macro definitions (#define) should be used for defining symbolic names for numeric constants.

For example: #define PI 3.141592

8. Use names of moderate length for variables. Most names should be between 2 and 12 letters

long.

9. Use underscores to make compound names easier to read: tot_vol or total_volumn is

clearer than totalvolumn.

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Wridemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order