In C programming:
This program involves implementing a simple Car Rental System that will allow the user to read, store, and manipulate customer data through a friendly text-based interface. During execution, the program stores all customer data in a linked list, and upon termination this data is automatically saved into a text file.The function definitions in file "proj-part1.c" are basically empty. Your main task in this project is to fill in the missing code based on the following descriptions of what each function is supposed to do. Empty functions and .txt files shown (cars.txt, customers.txt)
Car ID Car Make Car Model Year Unit Price Per Day MPG ----------------------------------------------------------------------------------------------------------------- 311 Chevrolet Chevelle-Malibu 1 2014 45.99 21 312 Buick Skylark-320 2014 79.95 19 313 Plymouth Satellite 2017 61.75 N/A 314 AMC Rebel-SST 2016 99.99 16 315 Ford Torino 2015 85.99 22.1 316 Ford Galaxie-500 2016 61.95 29.5 317 Chevrolet Impala 2013 42.99 18.7 318 Plymouth Fury-iii 2017 69.85 20.52 319 Pontiac Catalina 2012 29.99 N/A 320 AMC Ambassador-DPL 2015 95.99 16.30 321 Citroen DS-21-Pallas 2016 59.75 19.05
SSN First Name Last Name ----------------------------------------------- xxx-xx-3192 Farhad Akbar xxx-xx-0721 Bassam Awad Alanazi xxx-xx-9210 Roger Cungtha Biak xxx-xx-7226 Christian C. Collier xxx-xx-0802 Tanner Durnil xxx-xx-1155 Melissa Gudeman xxx-xx-7530 Daniel Patrick Kobold Jr xxx-xx-8162 Travis Lee Leondis xxx-xx-0011 Cleopatrio Soares Neto xxx-xx-5533 Daniel Biaklian Sang xxx-xx-1100 Bryant Bernard xxx-xx-8123 Joaquin John Garcia xxx-xx-3128 Jacob Austin Shebesh xxx-xx-9011 D'Artagnan S. Engle xxx-xx-1234 You Zhou xxx-xx-4321 Joi Ashlyn Officer
Effinclude
#include string.h #include structs h 10 11 12 I El /This function should open and read the given input file which contains information about all rental cars //It should store each can's data in an element of the given array arr, and return the number of cars it read from the file 13 //Notice that the file contains extra information which you should just skip/ignore option in fscanf) 14 using //The general format of the input file should be obvious from the example file provided final project input1 cars.txt 15 16 //obviously the value of member is available should be initialized to 1 for all elements of array arr 17 int r filename CanInfo arrt]) t eadCarsInfo(char 18 int 19 20 21 22 23 return n; 25 E his is similar to function readCarsInfo, except it reads customers information instead of cars information 26 /It should return the number of customers it read from the input file. 27 /The general format of the input file is indicated in the example file provided "final project input2 customers txt 28 29 int r "filename, CustInfo arr[]) eadCustomersInfo(char 30 int 31 32 33 return n 35 36 //This function should return a pointer to the element in array arr that contains the car whose 37 identification number is equal to the given value id 38 E CarInfo findCar (CarInfo arr[], int size, unsigned int id) t 39 Car Info "p NULL 41 42 return p 45 46 47 /This function should return a to pointer the element in array arr that contains the customer whose social security /umber is equal to the given value ssn (hint: you should use strncmp with n-4) E CustInfo findCustomer(CustInfo arr j, int size, char ssn) 50 51 CustInfo "p NULL 52 53 54 55 return p; 56 57 58 El //This function should first create a new node (dynamic variable) of type RentalInfo that contains rental information 59 /for the given car and the given customer and then this insert de at the beginning of given linked list 60 61 //Guidelines for implementation 62 63 use the input argument id to find the corresponding car in the cars array arr1 by calling function findCan use the input argument ssn to find the corresponding customer in the customers array arr2 by calling function findCustomer the value of member out date of the new node should be set by using the standard library time.h to determine the current date and hour. 65 the value of member num days of the new node should be equal to the input argument days 66 67 the value of member is available of the corresponding c RentalInfo rent a car RentalInfo list CarInfo arr1. int size1. CustInfo arr2 int size2 101, unsigned int id, chan *ssn, unsigned int days) 68 69 70 71 return list; 72 73 74 75 E//This function display on the screen the information in all elements of the given linked list //If the list is actually empty, the function should display a simple message such as "No rented cars. 76 //The output should be formatted such that it is elegant and easy to read void displayRentals entalInfo list) 78 79 80 81 82 Effinclude #include string.h #include structs h 10 11 12 I El /This function should open and read the given input file which contains information about all rental cars //It should store each can's data in an element of the given array arr, and return the number of cars it read from the file 13 //Notice that the file contains extra information which you should just skip/ignore option in fscanf) 14 using //The general format of the input file should be obvious from the example file provided final project input1 cars.txt 15 16 //obviously the value of member is available should be initialized to 1 for all elements of array arr 17 int r filename CanInfo arrt]) t eadCarsInfo(char 18 int 19 20 21 22 23 return n; 25 E his is similar to function readCarsInfo, except it reads customers information instead of cars information 26 /It should return the number of customers it read from the input file. 27 /The general format of the input file is indicated in the example file provided "final project input2 customers txt 28 29 int r "filename, CustInfo arr[]) eadCustomersInfo(char 30 int 31 32 33 return n 35 36 //This function should return a pointer to the element in array arr that contains the car whose 37 identification number is equal to the given value id 38 E CarInfo findCar (CarInfo arr[], int size, unsigned int id) t 39 Car Info "p NULL 41 42 return p 45 46 47 /This function should return a to pointer the element in array arr that contains the customer whose social security /umber is equal to the given value ssn (hint: you should use strncmp with n-4) E CustInfo findCustomer(CustInfo arr j, int size, char ssn) 50 51 CustInfo "p NULL 52 53 54 55 return p; 56 57 58 El //This function should first create a new node (dynamic variable) of type RentalInfo that contains rental information 59 /for the given car and the given customer and then this insert de at the beginning of given linked list 60 61 //Guidelines for implementation 62 63 use the input argument id to find the corresponding car in the cars array arr1 by calling function findCan use the input argument ssn to find the corresponding customer in the customers array arr2 by calling function findCustomer the value of member out date of the new node should be set by using the standard library time.h to determine the current date and hour. 65 the value of member num days of the new node should be equal to the input argument days 66 67 the value of member is available of the corresponding c RentalInfo rent a car RentalInfo list CarInfo arr1. int size1. CustInfo arr2 int size2 101, unsigned int id, chan *ssn, unsigned int days) 68 69 70 71 return list; 72 73 74 75 E//This function display on the screen the information in all elements of the given linked list //If the list is actually empty, the function should display a simple message such as "No rented cars. 76 //The output should be formatted such that it is elegant and easy to read void displayRentals entalInfo list) 78 79 80 81 82