Untitled

                Never    
C
       
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <direct.h>

//prototyping
int rent_duration(int a );
int selection_process(int b);
void case_1_rental();
void case_2_retail();
void case_3_sell2business();
void Vehicle_Display_Func_2();

//end of prototyping

//Global_structure_1
struct Vehicle
{
//Exclusive to function 3
    int  insure;
    char service[4];
    int mileage;
    char vehicle_being_sold[30];
//Generic elements char
    char fcus_name[15];
    char lcus_name[15];
    char  date[10];
    int  brand1;
    int  brand2;
    int rent_time;

};

//Arrays displaying Vehicle brands and their types

char * Honda[] = {"0-->Honda Cr-V","1-->Honda Civic","2-->Honda Acord","3-->Honda Pilot","4-->Honda Odyssey","5-->Honda HRV","6-->Honda Ridgeline"};
char * Toyota[] = {"0-->Toyota RAV4","1-->Toyota Tacoma","2-->Toyota Camry","3-->Toyota Highlander","4-->Toyota 4Runner","5-->Toyota Tundra"};
char * Mazda[] = {"0-->Mazda CX-5","1-->Mazda CX-9","2-->Mazda 3"};
char * Ford[] = {"0-->Ford Edge","1-->Ford Escape","2-->Ford Edge","3-->Ford Mustang","4-->Ford Explorer"};
char *Chevrolet[] = {"0-->Chevrolet Silverado 1500","1-->Chevrolet Equinox","2-->Chevrolet Traverse","3-->Chevrolet Colorado","4-->Chevrolet Camaro"};
char * Acura[] = {"0-->Acura RDX","1-->Acura MDX"};
char * BMW[] = {"0-->BMW X5","1-->BMW X3"};
char *Volkswagen[] = {"0-->Volkswagen Atlas","1-->Volkswagen Tiguan"};
char * Nissan[] = {"0-->Nissan Rogue"};
char * Dodge[] = {"0-->Dodge Challenger","1-->Dodge Durango"};
char * Lexus[] = {"0-->Lexus RX 350"};
char * Audi[] = {"0-->Audi Q7"};
char * Mercedes[] = {"0-->Mercedes - Benz GLC-Class"};
char * Kia[] = {"0-->Kia Sorento"};


int rent_price;

// A menu like area that defines where in the program you end up based on the code entered
int selection_process (int b)
{

    int code;
    puts("\n\n\t\t\t==================== S E L E C T I O N  S E C T I O N ====================");

    puts("\n\n\t============== It is in your own best interest to enter the correct information. Thank You! ==============\n\n");

    printf("\t\t\t\tPress 1 if you are looking to rent a vehicle\n");
    printf("\t\t\t\tPress 2 if you are looking to buy a vehicle\n");
    printf("\t\t\t\tPress 3 if you are looking to sell us a vehicle\n");
    printf("\n\t\t\t\t\t\tCode:");
    scanf("%d", &code);
// switch selection that directs the user to a particular function based on the code entered

    switch (code)
    {

    case 1:
        case_1_rental();
        break;

    case 2:
        case_2_retail();
        break;

    case 3:
        case_3_sell2business();
        break;

    default:
        printf("You've entered an invalid code, please try again\n");
    }
    return 0;
}

// This function deals with the customer renting a vehicle
void case_1_rental()
{

    int i,j,k,l,m,n,o,p,q,r,s,t,u,v;
    int Vnum,ans;
    float fresult;
    int ans2,x;


    Vehicle_Display_Func_2();

    puts("\n\n\t\t\t==================== R E N T A L  S E C T I O N ====================");
    puts("\n\nHow many transactions do you wish to process?");
    scanf("%i", &ans);

    struct Vehicle vehicle[ans];
//This loops stores the inputted data in their respective arrays
    for (x = 0 ; x < ans ; ++x)
    {

        printf("\t\t\t\tRecord %i\n\n",x + 1);

        printf("\n\nEnter your first name customer:\n");
        scanf(" %s", vehicle[x].fcus_name);

        printf("\n\nEnter last name customer:\n");
        scanf(" %s", vehicle[x].lcus_name);

        printf("\nEnter the date of which this transaction is being made in dd/mm/yyyy format :\t");
        scanf(" %s", vehicle[x].date);

        printf("\n\nHow many hours will the customer be renting the vehicle:\t");
        scanf("%i", &vehicle[x].rent_time);

//every hour the vehicle is rented cost is $15

        fresult=rent_duration(vehicle[x].rent_time);
        printf("\nrent price: $%.2f \n",fresult);

        printf("\n\nEnter the number left of the brand you wish to rent (1-14):");
        scanf("%i", &vehicle[x].brand1);

        switch (vehicle[x].brand1)
        {
//This switch brings up an array(s) in respect to the code  entered by the user
        case 1:
            printf("\n\n\t\t\t\t\t\t1----Honda---\n");

            for(i=0; i<7; ++i)
            {
                printf("\n \t\t\t\t\t\t%s", Honda[i]);
            }
            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Honda[Vnum]);
            break;

        case 2:
            printf("\n\n\t\t\t\t\t\t2----Toyota---\n");

            for(j=0; j<6; ++j)
            {
                printf("\n \t\t\t\t\t\t%s", Toyota[j]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Toyota[Vnum]);
            break;

        case 3:
            printf("\n\n\t\t\t\t\t\t3----Mazda---\n");

            for(k=0; k<3; ++k)
            {
                printf("\n \t\t\t\t\t\t%s", Mazda[k]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Mazda[Vnum]);
            break;

        case 4:
            printf("\n\n\t\t\t\t\t\t4----Ford---\n");

            for(l=0; l<5; ++l)
            {
                printf("\n \t\t\t\t\t\t%s", Ford[l]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:\n");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Ford[Vnum]);
            break;

        case 5:
            printf("\n\n\t\t\t\t\t\t5----Chevrolet---\n");

            for(m=0; m<5; ++m)
            {
                printf("\n \t\t\t\t\t\t%s", Chevrolet[m]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Chevrolet[Vnum]);
            break;

        case 6:
            printf("\n\n\t\t\t\t\t\t6----Acura---\n");

            for(n=0; n<2; ++n)
            {
                printf("\n \t\t\t\t\t\t%s", Acura[n]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Acura[Vnum]);
            break;

        case 7:
            printf("\n\n\t\t\t\t\t\t7----BMW---\n");

            for(o=0; o<2; ++o)
            {
                printf("\n \t\t\t\t\t\t%s", BMW[o]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", BMW[Vnum]);
            break;

        case 8:
            printf("\n\n\t\t\t\t\t\t8----Volkswagen---\n");

            for(p=0; p<2; ++p)
            {
                printf("\n \t\t\t\t\t\t%s", Volkswagen[p]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Volkswagen[Vnum]);
            break;

        case 9:
            printf("\n\n\t\t\t\t\t\t9----Nissan---\n");

            for(q=0; q<1; ++q)
            {
                printf("\n \t\t\t\t\t\t%s", Nissan[q]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Nissan[Vnum]);
            break;

        case 10:
            printf("\n\n\t\t\t\t\t\t10----Dodge---\n");

            for(r=0; r<2; ++r)
            {
                printf("\n \t\t\t\t\t\t%s", Dodge[r]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Dodge[Vnum]);
            break;

        case 11:
            printf("\n\n\t\t\t\t\t\t11----Lexus---\n");

            for(s=0; s<1; ++s)
            {
                printf("\n \t\t\t\t\t\t%s", Lexus[s]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Lexus[Vnum]);
            break;

        case 12:
            printf("\n\n\t\t\t\t\t\t12----Audi---\n");

            for(t=0; t<1; ++t)
            {
                printf("\n \t\t\t\t\t\t%s", Audi[t]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Audi[Vnum]);
            break;

        case 13:
            printf("\n\n\t\t\t\t\t\t13----Mercedes---\n");

            for(u=0; u<1; ++u)
            {
                printf("\n \t\t\t\t\t\t%s", Mercedes[u]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Mercedes[Vnum]);
            break;

        case 14:
            printf("\n\n\t\t\t\t\t\t14----Kia---\n");

            for(v=0; v<1; ++v)
            {
                printf("\n \t\t\t\t\t\t%s", Kia[v]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s", Kia[Vnum]);
            break;

        default:
            printf("You've entered a non-existent number from the options");
        }

        puts("\n\n-------------------------------------------------------------------\n\n");
    }

//Receipt

    puts("\n\n\t\t\t\t\t--------------------------------");
    puts("\t\t\t\t\t yes = 1 \t\t no = 0");
    puts("\t\t\t\t\t--------------------------------\n\n");
    puts("Would you like a receipt? Reply 1 or 0 : \t");
    scanf("%i", &ans2);

    if (ans2 == 1)
    {

        FILE * freciept_rental;

        // Opens the file
        freciept_rental = fopen("Rent_Rec.txt", "w");
        // writes to the file
        fprintf(freciept_rental, "\n\n==================== R E N T A L  R E C E I P T ====================");

        for (x = 0 ; x < ans ; ++x)


        {
            // A beep noise created before each record is printed. This is possible because of the inclusion of the windows library
            Beep(800,100);

            puts("\n\n\t\t\t==================== R E N T A L  R E C E I P T ====================");


            puts("\n\n\t\t\t\t\t--------------------------------");
            fprintf(freciept_rental, "\n\n--------------------------------\n");

            printf("Name of customer :\t%s %s\n",vehicle[x].fcus_name,vehicle[x].lcus_name);
            fprintf(freciept_rental, "Name of customer :\t%s %s\n",vehicle[x].fcus_name,vehicle[x].lcus_name);

            printf("Date of transaction :\t%s\n",vehicle[x].date);
            fprintf(freciept_rental, "Date of transaction :\t%s\n",vehicle[x].date);

            printf("Rent duration :\t%i hours\n",vehicle[x].rent_time);
            fprintf(freciept_rental, "Rent duration :\t%i hours\n", vehicle[x].rent_time);

            puts("\n\n\t\t\t\t\t--------------------------------");
            fprintf(freciept_rental, "\n\n\t--------------------------------");

            fprintf(freciept_rental, "\n\n==================== T H A N K   Y O U !  ====================");

        };
// Closes the file
        fclose(freciept_rental);
    }
    else if (ans2 == 0)
    {
        printf("Alright, no receipt it is.\n\n");
    }
    else
    {
        printf("wrong number\n\n");
    }

    return;
}

//This function deals with retailing
void case_2_retail()
{

    int V_type,Vnum,x,ans,ans2;
    int i,j,k,l,m,n,o,p,q,r,s,t,u,v;

//char arrays holds the vehicle types in respective to their brands & the float arrays hold their prices in order so there's co-relation between vehicle type and price

    char *Honda[] = {"0 Honda Cr-V\t\t\t","1 Honda Civic\t\t\t","2 Honda Acord\t\t\t","3 Honda Pilot\t\t\t","4 Honda Odyssey\t\t\t","5 Honda HRV\t\t\t","6 Honda Ridgeline\t\t"};
    float Honda_price[] = {40000,54000,32000,76000,64000,48000,64000};
    char * Toyota[] = {"0 Toyota RAV4\t\t\t","1 Toyota Tacoma\t\t\t","2 Toyota Camry\t\t\t","3 Toyota Highlander\t\t","4 Runner\t\t\t","5 Toyota Tundra\t\t\t"};
    float Toyota_price[] = {67087,75000,67900,765566,478585,787087};
    char * Mazda[] = {"0 Mazda CX-5\t\t\t","1 Mazda CX-9\t\t\t","2 Mazda 3\t\t\t"};
    float Mazda_price[] = {65768,59765,386090};
    char * Ford[] = {"0 Ford Edge\t\t\t","1 Ford Escape\t\t\t","2 Ford Edge\t\t\t","3 Ford Mustang\t\t\t","4 Ford Explorer\t\t\t"};
    float Ford_price[] = {86908,787977,78908,765876,86689};
    char * Chevrolet[] = {"0 Chevrolet Silverado 1500\t","1 Chevrolet Equinox\t\t","2 Chevrolet Traverse\t\t","3 Chevrolet Colorado\t\t","4 Chevrolet Camaro\t\t"};
    float Chevrolet_price[] = {465775,864654,865000,797000,676176};
    char *Acura[] = {"0 Acura RDX\t\t\t","1 Acura MDX\t\t\t"};
    float Acura_price[] = {100000,765656};
    char * BMW[] = {"0 BMW X5\t\t\t","1 BMW X3\t\t\t"};
    float BMW_price[] = {868,698,47,765};
    char * Volkswagen[] = {"0 Volkswagen Atlas\t\t","1 Volkswagen Tiguan\t\t"};
    float Volkswagen_price[] = {78767,68678};
    char * Nissan[] = {"0 Nissan Rogue\t\t\t"};
    float Nissan_price[] = {87847};
    char * Dodge[] = {"0 Dodge Challenger\t\t","1 Dodge Durango\t\t\t"};
    float Dodge_price[] = {60000,49500};
    char * Lexus[] = {"0 Lexus RX 350\t\t\t"};
    float Lexus_price[] = {54000};
    char * Audi[] = {"0 Audi Q7\t\t\t"};
    float Audi_price[] = {80000};
    char * Mercedes[] = {"0 Mercedes - Benz GLC-Class\t"};
    float Mercedes_price[] = {67000};
    char * Kia[] = {"0 Kia Sorento\t\t\t"};
    float Kia_price[] = {78000};


    printf("\t\t\t\t\tWelcome to retail section!");
    printf("\n\t\t\tHere you can purchase vehicles from Yak's Vehicle Rental");
    printf("\n\n\nOur available vehicle types are:");

    printf("\n\n\t\t\t\t\t\t1----Honda---\n");

//This loop prints the arrays above for display providing the user with a variety
    for(i=0; i<7; ++i)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Honda[i],Honda_price[i]);
    }


    printf("\n\n\t\t\t\t\t\t2----Toyota---\n");

    for(j=0; j<6; ++j)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Toyota[j],Toyota_price[j]);
    }


    printf("\n\n\t\t\t\t\t\t3----Mazda---\n");

    for(k=0; k<3; ++k)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Mazda[k],Mazda_price[k]);
    }


    printf("\n\n\t\t\t\t\t\t4----Ford---\n");

    for(l=0; l<5; ++l)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Ford[l],Ford_price[l]);
    }


    printf("\n\n\t\t\t\t\t\t5----Chevrolet---\n");

    for(m=0; m<5; ++m)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Chevrolet[m],Chevrolet_price[m]);
    }


    printf("\n\n\t\t\t\t\t\t6----Acura---\n");

    for(n=0; n<2; ++n)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Acura[n],Acura_price[n]);
    }


    printf("\n\n\t\t\t\t\t\t7----BMW---\n");

    for(o=0; o<2; ++o)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", BMW[o],BMW_price[o]);
    }


    printf("\n\n\t\t\t\t\t\t8----Volkswagen---\n");

    for(p=0; p<2; ++p)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Volkswagen[p],Volkswagen_price[p]);
    }


    printf("\n\n\t\t\t\t\t\t9----Nissan---\n");

    for(q=0; q<1; ++q)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Nissan[q],Nissan_price[q]);
    }


    printf("\n\n\t\t\t\t\t\t10----Dodge---\n");

    for(r=0; r<2; ++r)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Dodge[r],Dodge_price[r]);
    }


    printf("\n\n\t\t\t\t\t\t11----Lexus---\n");

    for(s=0; s<1; ++s)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Lexus[s],Lexus_price[s]);
    }


    printf("\n\n\t\t\t\t\t\t12----Audi---\n");

    for(t=0; t<1; ++t)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Audi[t],Audi_price[t]);
    }


    printf("\n\n\t\t\t\t\t\t13----Mercedes---\n");

    for(u=0; u<1; ++u)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Mercedes[u],Mercedes_price[u]);
    }


    printf("\n\n\t\t\t\t\t\t14----Kia---\n");

    for(v=0; v<1; ++v)
    {
        printf("\n \t\t\t\t\t\t%s $%.2f", Kia[v],Kia_price[v]);
    }

    puts("\n\n\t\t\t==================== R E T A I L  S E C T I O N ====================");

    puts("\n\nHow many transactions do you wish to process?");
    scanf("%i", &ans);



    struct Vehicle vehicle[ans];
    for (x = 0 ; x < ans ; ++x)
    {

        printf("\t\t\t\tRecord %i\n\n",x + 1);

        printf("\n\nEnter your first name customer:\n");
        scanf(" %s", vehicle[x].fcus_name);

        printf("\n\nEnter last name customer:\n");
        scanf(" %s", vehicle[x].lcus_name);

        printf("\nEnter the date of which this transaction is being made in dd/mm/yyyy format :\t");
        scanf(" %s", vehicle[x].date);

        printf("\n\n\nWhich would you like to purchase?\n");
        scanf("%i", &V_type);

        switch (V_type)
        {

        case 1:
            printf("\n\n\t\t\t\t\t\t1----Honda---\n");

            for(i=0; i<7; ++i)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Honda[i],Honda_price[i]);
            }
            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Honda[Vnum], Honda_price[Vnum]);
            break;

        case 2:
            printf("\n\n\t\t\t\t\t\t2----Toyota---\n");

            for(j=0; j<6; ++j)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Toyota[j],Toyota_price[j]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Toyota[Vnum],Toyota_price[Vnum]);
            break;

        case 3:
            printf("\n\n\t\t\t\t\t\t3----Mazda---\n");

            for(k=0; k<3; ++k)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Mazda[k],Mazda_price[k]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Mazda[Vnum],Mazda_price[Vnum]);
            break;

        case 4:
            printf("\n\n\t\t\t\t\t\t4----Ford---\n");

            for(l=0; l<5; ++l)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Ford[l], Ford_price[l]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:\n");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Ford[Vnum],Ford_price[Vnum]);
            break;

        case 5:
            printf("\n\n\t\t\t\t\t\t5----Chevrolet---\n");

            for(m=0; m<5; ++m)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Chevrolet[m],Chevrolet_price[m]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s  %.2f", Chevrolet[Vnum],Chevrolet_price[Vnum]);
            break;

        case 6:
            printf("\n\n\t\t\t\t\t\t6----Acura---\n");

            for(n=0; n<2; ++n)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Acura[n],Acura_price[n]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Acura[Vnum],Acura_price[Vnum]);
            break;

        case 7:
            printf("\n\n\t\t\t\t\t\t7----BMW---\n");

            for(o=0; o<2; ++o)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", BMW[o],BMW_price[o]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", BMW[Vnum],BMW_price[Vnum]);
            break;

        case 8:
            printf("\n\n\t\t\t\t\t\t8----Volkswagen---\n");

            for(p=0; p<2; ++p)
            {
                printf("\n \t\t\t\t\t\t%s%.2f", Volkswagen[p],Volkswagen_price[p]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Volkswagen[Vnum],Volkswagen_price[Vnum]);
            break;

        case 9:
            printf("\n\n\t\t\t\t\t\t9----Nissan---\n");

            for(q=0; q<1; ++q)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Nissan[q], Nissan_price[q]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Nissan[Vnum],Nissan_price[Vnum]);
            break;

        case 10:
            printf("\n\n\t\t\t\t\t\t10----Dodge---\n");

            for(r=0; r<2; ++r)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Dodge[r],Dodge_price[r]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Dodge[Vnum], Dodge_price[Vnum]);
            break;

        case 11:
            printf("\n\n\t\t\t\t\t\t11----Lexus---\n");

            for(s=0; s<1; ++s)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Lexus[s], Lexus_price[s]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Lexus[Vnum], Lexus_price[Vnum]);
            break;

        case 12:
            printf("\n\n\t\t\t\t\t\t12----Audi---\n");

            for(t=0; t<1; ++t)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Audi[t],Audi_price[t]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Audi[Vnum],Audi_price[Vnum]);
            break;

        case 13:
            printf("\n\n\t\t\t\t\t\t13----Mercedes---\n");

            for(u=0; u<1; ++u)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Mercedes[u],Mercedes_price[u]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Mercedes[Vnum],Mercedes_price[Vnum]);
            break;

        case 14:
            printf("\n\n\t\t\t\t\t\t14----Kia---\n");

            for(v=0; v<1; ++v)
            {
                printf("\n \t\t\t\t\t\t%s %.2f", Kia[v],Kia_price[v]);
            }

            printf("\n\n\nSelect the number next to the actual vehicle u wish to choose:");
            scanf("%i", &Vnum);
            printf("\n \t\t\t\t\t\t%s %.2f", Kia[Vnum],Kia_price[Vnum]);
            break;

        default:
            printf("You've entered a non-existent number from the options");
        }

        puts("\n\n-------------------------------------------------------------------\n\n");
    }

//Receipt

    puts("\n\n\t\t\t\t\t--------------------------------");
    puts("\t\t\t\t\t yes = 1 \t\t no = 0");
    puts("\t\t\t\t\t--------------------------------\n\n");
    puts("Would you like a receipt? Reply 1 or 0 : \t");
    scanf("%i", &ans2);

    if (ans2 == 1)
    {
        FILE * freciept_retail;

        freciept_retail = fopen("Retail_Rec.txt", "w");

        fprintf(freciept_retail, "\n\n==================== R E T A I L  R E C E I P T ====================");

        for (x = 0 ; x < ans ; ++x)
        {
            Beep(800,100);

            puts("\n\n\t\t\t==================== R E T A I L  R E C E I P T ====================");

            puts("\n\n\t\t\t\t\t--------------------------------");
            fprintf(freciept_retail, "\n\n\t\t\t\t\t--------------------------------");

            printf("Name of customer :\t%s %s\n",vehicle[x].fcus_name,vehicle[x].lcus_name);
            fprintf(freciept_retail, "\n\nName of customer :\t%s %s\n",vehicle[x].fcus_name,vehicle[x].lcus_name);

            printf("Date of transaction :\t%s\n",vehicle[x].date);
            fprintf(freciept_retail, "Date of transaction :\t%s\n",vehicle[x].date);

            puts("\n\n\t\t\t\t\t--------------------------------");
            fprintf(freciept_retail, "\n\n\t\t\t\t\t--------------------------------");

            fprintf(freciept_retail, "\n\n==================== T H A N K   Y O U !  ====================");

        };

        fclose(freciept_retail);
    }
    else if (ans2 == 0)
    {
        printf("Alright, no receipt it is.");
    }
    else
    {
        printf("wrong number");
    }

    return;
}

//The main function
int main()
{
    int b=0;
//calling the selection_process above

    selection_process(b);

    return 0;
}


//A small function to calculate rent price. This function is called in the rent function
//the function is of type int because it's returning a value, rent_price
int rent_duration(int a )
{
    int rent_price;

    rent_price = a * 15;

    return rent_price;
}


//This function deals with the user selling a vehicle to the  business
void case_3_sell2business()
{

    int x,ans,ans2;

    float calc_avg_mile;

    puts("\n\n\t\t\t==================== R E T U R N S  S E C T I O N ====================");

    puts("\n\nHow many transactions do you wish to process?");
    scanf("%i", &ans);

//structure here
    struct Vehicle vehicle[ans];

//This loops stores all user inputs in respective arrays
    for (x = 0 ; x < ans ; ++x)
    {
        printf("\n\nEnter your first name customer:\n");
        scanf(" %s", vehicle[x].fcus_name);

        printf("\n\nEnter last name customer:\n");
        scanf(" %s", vehicle[x].lcus_name);

        printf("\nEnter the date of which this transaction is being made:\n");
        scanf(" %s", vehicle[x].date);

        printf("\nWhat vehicle are you selling?\n");
        scanf(" %[^\n]s", vehicle[x].vehicle_being_sold);

        printf("\nIs the vehicle insured? Type 1 for yes and 0 for no\n ");

        puts("\n\n\t\t\t\t\t--------------------------------");
        puts("\t\t\t\t\t yes = 1 \t\t no = 0");
        puts("\t\t\t\t\t--------------------------------\n\n");
        scanf("%d", &vehicle[x].insure);



//beginning of if
        if  (vehicle[x].insure == 1)
        {

            printf("\nThen we'll take your vehicle\n");
        }
        else if (vehicle[x].insure == 0)
        {
            printf("we don't want your vehicle\n");
        }
        else
        {
            printf("wrong number\n");
        }
//Ending of if

        printf("\nIs the vehicle serviced?\t");
        scanf("%s", vehicle[x].service);

//The less mileage on the vehicle the better
        printf("\nWhat is the mileage on the vehicle that you are selling? :");
        scanf("%i", &vehicle[x].mileage);

//average mileage is 12,000
        if (vehicle[x].mileage<12000)
        {
            calc_avg_mile = vehicle[x].mileage*54.5;

            printf("\n$%.2f will be deducted from your sale amount as a result of the amount of mileage gained on the vehicle \n\n",calc_avg_mile);
        }
    }


//Receipt the prints the elements of the arrays through looping

    puts("\n\n\t\t\t\t\t--------------------------------");
    puts("\t\t\t\t\t yes = 1 \t\t no = 0");
    puts("\t\t\t\t\t--------------------------------\n\n");
    puts("Would you like a receipt? Reply 1 or 0 : \t");
    scanf("%i", &ans2);

    if (ans2 == 1)
    {
        FILE * freciept_return;

        //Opens file for writing
        freciept_return = fopen("Return_Rec.txt", "w");

        fprintf(freciept_return, "\n\n==================== R E T U R N  R E C E I P T ====================");

        //loops through arrays so they gets written to the file
        for (x = 0 ; x < ans ; ++x)
        {
            Beep(800,100);

            puts("\n\n\t\t\t==================== R E T U R N  R E C E I P T ====================");

            puts("\n\n\t\t\t\t\t--------------------------------");
            fprintf(freciept_return, "\n\n\t--------------------------------\n");

            printf("Name of customer :\t%s %s\n",vehicle[x].fcus_name,vehicle[x].lcus_name);
            fprintf(freciept_return, "Name of customer :\t%s %s\n",vehicle[x].fcus_name,vehicle[x].lcus_name);

            printf("Date of transaction :\t%s\n",vehicle[x].date);
            fprintf(freciept_return, "Date of transaction :\t%s\n",vehicle[x].date);

            printf("Vehicle being returned :\t%s\n",vehicle[x].vehicle_being_sold);
            fprintf(freciept_return, "Vehicle being returned :\t%s\n",vehicle[x].vehicle_being_sold);

            printf("Vehicle service status : %s\n", vehicle[x].service);
            fprintf(freciept_return, "Vehicle service status : %s\n", vehicle[x].service);

            printf("Vehicle mileage : %i Mph\n", vehicle[x].mileage);
            fprintf(freciept_return, "Vehicle mileage : %i Mph\n", vehicle[x].mileage);

            printf("Deduction from customer sale price :$%.2f",calc_avg_mile);
            fprintf(freciept_return, "Deduction from customer sale price :$%.2f",calc_avg_mile);

            puts("\n\n\t\t\t\t\t--------------------------------");
            fprintf(freciept_return, "\n\n\t--------------------------------");

            fprintf(freciept_return, "\n\n==================== T H A N K   Y O U !  ====================");

        };

//closes the file
        fclose(freciept_return);
    }
    else if (ans2 == 0)
    {
        printf("Alright, no receipt it is.\n\n");
    }
    else
    {
        printf("wrong number\n\n");
    }


    return;
}


//This function is responsible for looping through the arrays and displaying the elements in it, straight forward
//This is a function because this piece of code be being used in multiple places in my source code so, its a function to avoid repetition.
void Vehicle_Display_Func_2()
{

    int i,j,k,l,m,n,o,p,q,r,s,t,u,v;


    printf("\n\n\t\t\t\t\t\t1----Honda---\n");

    for(i=0; i<7; ++i)
    {
        printf("\n \t\t\t\t\t\t%s", Honda[i]);
    }


    printf("\n\n\t\t\t\t\t\t2----Toyota---\n");

    for(j=0; j<6; ++j)
    {
        printf("\n \t\t\t\t\t\t%s", Toyota[j]);
    }


    printf("\n\n\t\t\t\t\t\t3----Mazda---\n");

    for(k=0; k<3; ++k)
    {
        printf("\n \t\t\t\t\t\t%s", Mazda[k]);
    }


    printf("\n\n\t\t\t\t\t\t4----Ford---\n");

    for(l=0; l<5; ++l)
    {
        printf("\n \t\t\t\t\t\t%s", Ford[l]);
    }


    printf("\n\n\t\t\t\t\t\t5----Chevrolet---\n");

    for(m=0; m<5; ++m)
    {
        printf("\n \t\t\t\t\t\t%s", Chevrolet[m]);
    }


    printf("\n\n\t\t\t\t\t\t6----Acura---\n");

    for(n=0; n<2; ++n)
    {
        printf("\n \t\t\t\t\t\t%s", Acura[n]);
    }


    printf("\n\n\t\t\t\t\t\t7----BMW---\n");

    for(o=0; o<2; ++o)
    {
        printf("\n \t\t\t\t\t\t%s", BMW[o]);
    }


    printf("\n\n\t\t\t\t\t\t8----Volkswagen---\n");

    for(p=0; p<2; ++p)
    {
        printf("\n \t\t\t\t\t\t%s", Volkswagen[p]);
        printf("\n \t\t\t\t\t\t%s", Volkswagen[p]);
    }


    printf("\n\n\t\t\t\t\t\t9----Nissan---\n");

    for(q=0; q<1; ++q)
    {
        printf("\n \t\t\t\t\t\t%s", Nissan[q]);
    }


    printf("\n\n\t\t\t\t\t\t10----Dodge---\n");

    for(r=0; r<2; ++r)
    {
        printf("\n \t\t\t\t\t\t%s", Dodge[r]);
    }


    printf("\n\n\t\t\t\t\t\t11----Lexus---\n");

    for(s=0; s<1; ++s)
    {
        printf("\n \t\t\t\t\t\t%s", Lexus[s]);
    }


    printf("\n\n\t\t\t\t\t\t12----Audi---\n");

    for(t=0; t<1; ++t)
    {
        printf("\n \t\t\t\t\t\t%s", Audi[t]);
    }


    printf("\n\n\t\t\t\t\t\t13----Mercedes---\n");

    for(u=0; u<1; ++u)
    {
        printf("\n \t\t\t\t\t\t%s", Mercedes[u]);
    }


    printf("\n\n\t\t\t\t\t\t14----Kia---\n");

    for(v=0; v<1; ++v)
    {
        printf("\n \t\t\t\t\t\t%s", Kia[v]);
    }

    return;
}

Raw Text