Question: STARTER CODE INCLUDED! Please write the following functions in C. You do not need to write the main function, just these functions. Thank you! Function
STARTER CODE INCLUDED! Please write the following functions in C. You do not need to write the main function, just these functions. Thank you!



Function Prototypes (text version):
void addToFront( list_t *list );
// creates a new watercraft from user input and then adds it to the front of // the list // increments the list size void addToRear( list_t *list ); // creates a new watercraft from user input and then adds it to the rear of // the list; should use the tail pointer // increments the list size //Printing Entire List Of All Watercraft Or Specs Of Chosen Watercraft: void printList ( list_t *list ); // prints all the watercraft in the list void printSpecs ( list_t *list ); // prints a list of the watercraft (i.e.calls printList()) and asks user to // choose which one to show the specs of // the specs will include the extra items and their associated costs, if applicable //Deleting A Watercraft: void deleteWatercraft( list_t *list ); // prints the list of watercraft (i.e.calls printList()) and lets the user // choose which one to delete // then deletes the chosen watercraft from the list // decrements the list size // if list is empty, prints message that the list is empty //Searching For And Printing Watercraft By Type Or Motor: int typeInInventory( list_t *list, char whichOne[] ); // called by searchByType() function // search the list and return a 1 if that type is found, 0 if not found int motorInInventory( list_t *list, int whichOne ); // called by searchByMotorType() function // search the list and return a 1 if that motor type is found, 0 if not found // (0 for no motor, 1 for out-board motor, and 2 for in-board) void printWatrcraftByType( list_t *list, char whichOne[] ); // traverses the list for the type that matches whichOne and prints all found void printWatrcraftByMotor( list_t *list, int whichOne ); // traverses the list for propulsion that matches whichOne and returns all found void searchByType( list_t *list ); // prints choices of types for user to choose the desired one // (e.g. 1 for pontoon, 2 for fishing, etc.) // uses if-else statement or switch statement to call typeInInventory() sending the // list and the string for the type chosen (e.g. pontoon or fishing, etc.) // if typeInInventory() returns a 1, call printWatercraftByType() void searchByMotorType( list_t *list ); // prints motor types for user to choose the desired one // (e.g. 1 for no motor, 2 for out-board motor, 3 for in-board motor) // uses if-else statement or switch statement to call motorInInventory() sending the // list and the integer for the type chosen (0, 1, or 2) // if typeInInventory() returns a 1, call printWatercraftByMotorType() //Printing Watercraft By Price In Order From Lowest To Highest: void printByPrice( list_t *list ); // creates a new local list built from the existing list where each watercraft // is added in order from lowest to highest // once the new list of watercraft in order of price from lowest to highest is // built, then call printList() to print the sorted list //Utility Function That Can Be Used In Your Other Functions: int isEmpty( list_t *list ); // returns 1 if the list is empty and 0 if it is not empty //Print Total Asset Value Of All Watercraft: void TAV( list_t *list ); // prints the total asset value of all inventory (sum of total_price)
STARTER CODE (header):
#ifndef SLL_LIST_H #define SLL_LIST_H #include
watercraft.txt (text file that contains content to be read into code) (can be copy and pasted):
pontoon,Crest,Carribean RS 230 SLC,1,Suzuki,115,Blue,26,134595.00,135945.00,1,200,0,250,450,450,0 fishing,Key West,239 FS,1,Mercury,250,Orange,24,86430.00,87630.00,0,0,250,200,500,250,0 sport boat,Tahoe,T16,1,Yamaha,300,Yellow,22,26895.00,27745.00,0,250,0,0,350,250,0 pontoon,Bennington,24 Slx,1,Mercury,140,Brown,24,83299.00,84049.00,1,250,0,200,0,300,0 kayak,Wilderness Systems,Tarpon 120 SOT,0,None,0,Red/Orange/Yellow,12,999.00,1149.00,0,0,0,0,0,0,150 pontoon,Suntracker,Bass Buggy 16 XL,1,Suzuki,115,Silver,22,13990.00,14990.00,1,200,0,250,300,250,0 pontoon,Crest,Classic LX 220 SLC,1,Mercury,115,Green,24,45599.00,47149.00,1,250,350,200,450,300,0 fishing,Phoenix,Bass Boat 920 Elite,2,Chevrolet,300,Orange,28,46995.00,48195.00,0,0,250,300,400,250,0 kayak,Eddyline,Rio,0,None,0,Green Apple,12,1429.00,1714.00,0,0,0,0,0,0,285 canoe,Old Town,Penobscot 164 ,0,None,0,Green,16,1299.95,1524.90,0,0,0,0,0,0,224.95 canoe,Mad River,Adventure 16,0,None,0,Red,16,899.00,1058.95,0,0,0,0,0,0,159.95 pontoon,Crest,Classic LX 200 L,1,Yamaha,150,Black,22,31816.00,33016.00,1,200,0,250,450,300,0 sport boat,Chaparral,297 Surf SSX,2,Chevrolet,300,Purple,24,220079.00,221279.00,0,250,350,0,400,200,0 fishing,Avenger,AV24,1,Yamaha,115,Gray,28,89995.00,90795.00,0,0,250,0,350,200,0 sport boat,Sea Ray,SDX 270,2,Chevrolet,300,Blue,28,185113.00,186213.00,0,200,300,0,350,250,0 fishing,Nitro,Z18 Pro,1,Suzuki,140,Black,30,35585.00,36235.00,0,0,0,0,400,250,0 pontoon,Bennington,25 Qxfb,1,Mercury,115,White,22,167000.00,168250.00,1,250,0,250,450,300,0 pontoon,Bentley,200 Cruise,1,Mercury,90,Silver,20,36995.00,37795.00,1,200,350,250,0,0,0
IF ANY EXTRA INFO IS NEEDED PLEASE COMMENT! I can update and provide starter code, too. However, formatting is not AS important and I mostly just need the functions to work.
// Adding Additional Watercraft: void addToFront ( list_t *list ); // creates a new watercraft from user input and then adds it to the front of // the list // increments the list size void addToRear( list t *list ); // creates a new watercraft from user input and then adds it to the rear of // the list; should use the tail pointer // increments the list size // Printing Entire List of All Watercraft or Specs Of Chosen Watercraft: void printList ( list_t *list ); // prints all the watercraft in the list void printSpecs ( list_t *list ); // prints a list of the watercraft (i.e.calls printList()) and asks user to // choose which one to show the specs of // the specs will include the extra items and their associated costs, if applicable //Deleting A Watercraft: void deleteWatercraft( list_t *list ); // prints the list of watercraft (i.e.calls printList()) and lets the user // choose which one to delete // then deletes the chosen watercraft from the list // decrements the list size // if list is empty, prints message that the list is empty // Searching For And Printing Watercraft By Type Or Motor: int typeInInventory( list_t *list, char whichone[] ); // called by searchByType() function // search the list and return a 1 if that type is found, o if not found int motorInInventory( list_t *list, int whichone ); // called by searchByMotorType() function // search the list and return a 1 if that motor type is found, o if not found // (o for no motor, I for out-board motor, and 2 for in-board) void printwatrcraftByType( list_t *list, char whichone[] ); // traverses the list for the type that matches whichone and prints all found void printwatrcraftByMotor( list_t *list, int whichone ); // traverses the list for propulsion that matches whichone and returns all found void searchByType( list_t *list ); // prints choices of types for user to choose the desired one // (e.g. i for pontoon, 2 for fishing, etc.) // uses if-else statement or switch statement to call typeInInventory() sending the // list and the string for the type chosen (e.g. "pontoon" or "fishing", etc.) // if typeInInventory() returns a 1, call printwatercraftByType() void searchByMotorType( list_t *list ); // prints motor types for user to choose the desired one // (e.g. i for no motor, 2 for out-board motor, 3 for in-board motor) // uses if-else statement or switch statement to call motorInInventory() sending the // list and the integer for the type chosen (0, 1, or 2) // if typeInInventory() returns a 1, call printwatercraftByMotorType() //Printing Watercraft By Price In Order From Lowest To Highest: void printByPrice list_t *list ); // creates a new local list built from the existing list where each watercraft // is added in order from lowest to highest // once the new list of watercraft in order of price from lowest to highest is // built, then call printList() to print the sorted list //Utility Function That Can Be Used In Your Other Functions: int isEmpty( list_t *list ); // returns 1 if the list is empty and @ if it is not empty //Print Total Asset value of All Watercraft: void TAVC list_t *list ); // prints the total asset value of all inventory (sum of total price) // Adding Additional Watercraft: void addToFront ( list_t *list ); // creates a new watercraft from user input and then adds it to the front of // the list // increments the list size void addToRear( list t *list ); // creates a new watercraft from user input and then adds it to the rear of // the list; should use the tail pointer // increments the list size // Printing Entire List of All Watercraft or Specs Of Chosen Watercraft: void printList ( list_t *list ); // prints all the watercraft in the list void printSpecs ( list_t *list ); // prints a list of the watercraft (i.e.calls printList()) and asks user to // choose which one to show the specs of // the specs will include the extra items and their associated costs, if applicable //Deleting A Watercraft: void deleteWatercraft( list_t *list ); // prints the list of watercraft (i.e.calls printList()) and lets the user // choose which one to delete // then deletes the chosen watercraft from the list // decrements the list size // if list is empty, prints message that the list is empty // Searching For And Printing Watercraft By Type Or Motor: int typeInInventory( list_t *list, char whichone[] ); // called by searchByType() function // search the list and return a 1 if that type is found, o if not found int motorInInventory( list_t *list, int whichone ); // called by searchByMotorType() function // search the list and return a 1 if that motor type is found, o if not found // (o for no motor, I for out-board motor, and 2 for in-board) void printwatrcraftByType( list_t *list, char whichone[] ); // traverses the list for the type that matches whichone and prints all found void printwatrcraftByMotor( list_t *list, int whichone ); // traverses the list for propulsion that matches whichone and returns all found void searchByType( list_t *list ); // prints choices of types for user to choose the desired one // (e.g. i for pontoon, 2 for fishing, etc.) // uses if-else statement or switch statement to call typeInInventory() sending the // list and the string for the type chosen (e.g. "pontoon" or "fishing", etc.) // if typeInInventory() returns a 1, call printwatercraftByType() void searchByMotorType( list_t *list ); // prints motor types for user to choose the desired one // (e.g. i for no motor, 2 for out-board motor, 3 for in-board motor) // uses if-else statement or switch statement to call motorInInventory() sending the // list and the integer for the type chosen (0, 1, or 2) // if typeInInventory() returns a 1, call printwatercraftByMotorType() //Printing Watercraft By Price In Order From Lowest To Highest: void printByPrice list_t *list ); // creates a new local list built from the existing list where each watercraft // is added in order from lowest to highest // once the new list of watercraft in order of price from lowest to highest is // built, then call printList() to print the sorted list //Utility Function That Can Be Used In Your Other Functions: int isEmpty( list_t *list ); // returns 1 if the list is empty and @ if it is not empty //Print Total Asset value of All Watercraft: void TAVC list_t *list ); // prints the total asset value of all inventory (sum of total price)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
