Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the C program from project 9(which split dealer.c into three source files and two header files which can be found below in the pictures)

Modify the C program from project 9(which split dealer.c into three source files and two header files which can be found below in the pictures) by adding and modifying the following functions:

1) Add a delete function in car.c that deletes a car from the list. The function should delete a player by the cars make, model, color, and manufacture year. This information will be entered by the user. The function should have the following prototype:

struct car* delete_from_list(struct car *list);

-You will also need to add the function prototype to the header file; modify the main function in dealer.c to add d for delete option in the menu and it calls the delete function when the d option is selected.

2.) Modify the append_to_list function so the car is inserted into an ordered list (by make, then model) and the list remains ordered after the insertion. For example, ford escape should be before ford taurus in the list; ford taurus should be before jeep wrangler in the list; if the make and model are the same, the car entries do not need to be ordered by other members.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

image text in transcribed

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

image text in transcribed

image text in transcribed

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

image text in transcribed

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

image text in transcribed

1 L Name: car.c 2Purpose: Splits project8 into three source files and two header files 3 Author: Garret Moses / 5 #include "readline 6 #include "car.h" 8 struct car append_to list (struct car list) 9 struct car newcar = (struct car*)malloc (sizeof (struct car)); l1 newCar->nextNULL; 12 13 printf ("Enter Make: ") 14 read 1ine (newCar->make, LEN): 15 printf ("Enter Model: ")i 16 read line (newCar->model, LEN) 17 printf ("Enter Color:) 18 read line (newCar->color, LEN) 19 printf ("Enter year:) 20 scanf ("d, anewCar->year) 21 printf ("Enter city MPG: 22 scanf ("sd", &newCar->city mpg) 23 printf ("Enter Highway MPG:) 24 scanf("%d", &newcar->highwaympg); 25 printf ("Enter Quantity: ) 26 scanf ("%d", &newcar->quantity); 27 28 if (listNULL) ( 29 30 else 31 struct car ptr list; 32 33 while (1) ( 34 35 if( (strp (ptr->make, newcar->make ) ==0 ) && 36 37 (stremp (ptr-model, newCar->model)0) & - return newCar; 39 (strcmp (ptr->color, newCar->color)0) && 40 41 (ptr-year newCar->year) && 43 (ptr->city mpg-newCar->city mpg) && 45 (ptr->highwaympg-newCar->highwaympg) &&

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

Students also viewed these Databases questions

Question

What accommodations might be helpful?

Answered: 1 week ago