Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the below program dealer.c so that the program is split into three source files and two header files. A) Put all functions related to

Modify the below program dealer.c so that the program is split into three source files and two header files.

A) Put all functions related to operations on the list of cars into car.c.

B) Create a header file named car.h that contains struct car declaration and prototypes for the functions in car.c. The header file should enclose the contents of the header file in an #ifndef-#endif pair to protect the file.

C) Put the read_line function in a separate file named readline.c.

D) Create a header file named readline.h that contains a prototype for the read_line function. The header file should enclose the contents of the header file in an #ifndef-#endif pair to protect the file.

E) dealer.c contains the main function.

F) Include appropriate header files in the source files.

2.) Write a makefile to build the program on student cluster. The makefile should contain the following rules:

A) Build readline.o by compiling readline.c.

B) Build car.o by compiling car.c.

C) Build dealer.o by compiling dealer.c

D) Build dealer by linking readline.o, car.o, and dealer.o

Each rule should include the name of the target file, dependencies among files, and the command to be executed. The makefile should name the executable file for the program

dealer.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

7 8 9 10 #include #include #include #include 12 #de fine LEN 30 13 14 struct cart 15 16 17 18 19 20 21 char make [LEN+1] char model [LEN+1] char color[LEN+11 int year: int city mpg: int highway mpg: int quantity: struct car next; 23 24 25 26 struct car* append to list (struct car list); 27 void find car (struct car list); 28 void printList (struct car list); 29 void clearList (struct car list); 30 int read line (char str[],int n); 31 32 struct car temp 34 int main (void) 35 ( 36 char code 37 38 struct car car list-NULL ; 39 printf ("Operation code: a for appending the list In f for finding the car In p for printing the list In q for quit.n") 40 1 for) i 42 printf("Enter operation code: ) 43 44 while (getchar ( ) != " ") 45 46 switch (code) 47 case 'a car_1ist-append to1ist (car 1ist) scanf ("%c", &code) ; 49 case ": find, car (carlist); 50 51 case'p printList (car_list): break: break: break: - 52 53 default: printf ("Illegal codeln") 54 56 57 printf("n") 58 59 60 61

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago