Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Declare a structure of type Car to represent a motor car including the elements:

ID: 3610711 • Letter: D

Question

Declare a structure of type Car to represent a motor car including the elements: make (string, ie either an array of chars or a pointer to a char) manufactureDate (Date - see below) purchaseDate (Date - see below) purchasePrice (double) You will need to also declare a structure of type Date to represent the: day (int) month (int) year (int) (That is, you will have structures nested inside a structure.) Write a program that reads (from the user or a file - the user is given a choice) the above car information for a number of cars. Put this in an array called fleet that can hold up to 10 cars. (The program is to be able to handle a fleet of less than 10 cars as well. You may like to use a sentental value for this purpose.) The program can give the user the following options: add a car; delete last car (ie the last car on the array); display the fleet on the screen; save the fleet to a file; read the fleet from a file. You are not expected to be able to originally create the file externally to your program (ie you can only read it after you have saved it from your program). You are free to use either a binary or text file (hint: binary files are much easier). Write the following input functions: addCar ( ) and getDate( ) (which gets the information from the user) and readFleet ( ) (which reads the information from a file). (You are to use the "pass-by-reference" rather than the "return" mechanism for these functions.) Write the following output functions: showFleet ( ), showCar ( ), showDate( ), (which prints the information to the screen) and saveFleet ( ) (which saves the information to a file). Note that the purchase price is to have a '$' sign before the amount and the amount is to be printed to two decimal places. Both the getDate( ) and showDate( ) functions should be generic enough to handle both the manufactureDate and purchaseDate. Your program is to have appropriate error checking for user input and file I/O. That is, for user input, you need to check that the dates (ie day, month, and year) and purchase price are within an appropriate range. For the file I/O you need to check for fopen() returning a NULL pointer. You do not have to check for type mismatching.

Explanation / Answer

please rate-thanks I wasn't able to do the call by reference, no matter how Itried #include #include using namespace std; struct date{ int day; int month; int year; }; struct car{ char make[10]; struct date man; struct date pur; double price; }fleet[10]; car addcar(); date getdate(); void readfleet(struct car[],int*); void showfleet(struct car[],int); void showcar(struct car); void showdate(struct date); void savefleet(struct car[],int); bool validate(int,int,int); int menu(); int main() {bool done=false; int choice,count=0,max=10; do { choice=menu(); switch(choice) {case 1:if(count==10)            printf("Sorry fleet full ");          else            {            fleet[count]= addcar();            count++;             }          break; case 2:if(countdays[m-1]||d
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote