Defining user-defined data type for car dealership database


1. a) Define a user-defined data type (struct) called Car to represent a car in the context of a car dealership database. Car should have at least the following characteristics:

Make
Model
Year
Vehicle Identification Number (VIN)
Color

You would require to decide on appropriate data types of each of the above characteristics.

i) Write the function called createAndInitializeCar which dynamically allocates memory for the Car object, populates it with values based on user input and returns a pointer to the newly created object.

ii) Write the function called printCarDetails which takes a Car and prints out its details in the readable format.

iv) Write the function called changeCarColor which takes a Car and a color as parameters and changes the color of the given car to the given color.

b) Create the user-defined data structure (struct) known as Node which represents a node within the linked list where the “data” stored in each node is a pointer to a Car object.

i) Write function called insertCarIntoList which takes creates the new Car (using the createAndInitializeCar function) and inserts it at the end of a given linked list of cars.

ii) Write the function called deleteCarFromList which takes a VIN and deletes Car in a given list that has the given VIN. If the car with the given VIN is not found in the given list, display the appropriate message to the user.

iii) Write a “main” function which defines external pointer to point to the beginning of a linked list of cars and repeatedly calls insertCarIntoList as long as the user wishes to continue to insert new nodes into the list pointed to by the external pointer. Once the user is done inserting nodes, ask the user to enter a VIN and then call deleteCarFromList function to delete Car with VIN from the list created above.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Defining user-defined data type for car dealership database
Reference No:- TGS0725

Expected delivery within 24 Hours