Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an inventory database for a used car lot. Support the following actions: Search the database for a particular vehicle. Add a new car to

Create an inventory database for a used car lot. Support the following actions: Search the database for a particular vehicle. Add a new car to the database. Delete a car from the database. The database must remain sorted by vehicle ID. Each car has the following characteristics: vehicle ID, make, model, year, mileage, cost. Because its a linked list, we also need a pointer to the next node in the list:

typedef struct carType Car; struct carType { int vehicleID; char make[20]; char model[20]; int year; int mileage; double cost; Car *next; /* ptr to next car in list */ } Searching, adding, and deleting all require us to find a particular node in the list. We scan the list until we find a node whose ID is >= the one were looking for. Create a new node with the proper info. Find the node (if any) with a greater vehicleID. Splice the new node into the list: Find the node that points to the desired node at a position. Redirect that nodes pointer to the next node (or NULL). Free the deleted nodes memory.

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

Students also viewed these Databases questions