Sei sulla pagina 1di 52

#include<stdio.

h>

#include<errno.h>

#include<stdlib.h>

#include<string.h>

#define string_length 20

float TotalRevenueCC;

float TotalAssetCC;

int Facility1;

float TotalRevenueSL;

float TotalAssetSL;

int Facility2;

float TotalRevenueBT;

float TotalAssetBT;

int Facility3;

struct AircraftInfo{

int id;

char model_name[ string_length];


char customer_name[ string_length ];

int modelnumber;

float height;

float length;

float wingspan;

float weight;

char engine[string_length];

float Storageduration;

float AssetWorth;

int Location;

float TransportCost;

float StorageFee;

};

/*create propertyinfo with default information*/

int MenuChoice()//menu gives user a list of options

int choice;
printf("============================================================\n\n ");

printf("OPTION DESCRIPTION \n\n");

printf("============================================================\n\n ");

printf("1 Create a new file\n\n");

printf(" 2 Add Aircraft Information\n\n");

printf(" 3 Display Aircraft information \n\n");

printf(" 4 Search by ID Number\n\n");

printf(" 5 Update Storage Information\n\n ");

printf(" 6 Delete a record\n\n ");

printf(" 7 View Location Information\n\n");

printf(" 8 View Company Financial Staistics\n\n");

printf(" 9 Exit program\n\n ");

printf("============================================================\n\n ");

printf("=>=>=>=>=>=>=>Barbados Air Storage & Transport=>=>=>=>=>=>=>\n\n");

printf("============================================================\n\n ");

printf("Task=====>");

scanf("%d",&choice);
return choice;

}/*End Function*/

void CreateFile()//Creates a New File

FILE*inDataFile1;

int f,result;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "wb"))==NULL)

printf("Cannot open file \n");

result=MenuChoice();

}//END IF

else

for (f=0;f<=100;f++)//File can store 100 records

fwrite(&property,sizeof(struct AircraftInfo),1,inDataFile1);

} //END FOR
fclose(inDataFile1);

}//END ELSE

printf(" FILE CREATED \n\n");

void AddInfo()//Adding Records to File

int result;

FILE*inDataFile1;

float UtilCost1=1200.75;

float EmployCost1=30000.00;

float Tax1=5600.0;

float StorageRate1=20000.50;

float UtilCost2=370.00;

float EmployCost2=15000.00;

float Tax2=1000.00;

float StorageRate2=40000.00;

float UtilCost3=2300.50;

float EmployCost3=18900.75;

float Tax3=1500.00;

float StorageRate3=37500.50;
struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");

result=MenuChoice();

}/*ENDIF*/

printf("Enter Asset ID -------->");

scanf("%d",&property.id);

printf("Enter Model Name -------->");

scanf("%s",&property.model_name);

printf("Enter Name of Customer -------->");

scanf("%s",&property.customer_name);

printf("Enter Modelnumber -------->");


scanf("%d",&property.modelnumber);

printf("Enter Height of Aircraft-------->");

scanf("%f",&property.height);

if (property.height<5)//User cannot enter a value below 5

printf("\n\nThis is invalid information!\n\n");

exit(1);//Terminates program

printf("Enter Length of Aircraft-------->");

scanf("%f",&property.length);

if (property.length<20)//User cannot enter value below 20

printf("This is invalid information! ");

exit(1);//Terminates program

printf("Enter Wingspan of Aircraft------>");

scanf("%f",&property.wingspan);
if (property.wingspan<20)//User cannot enter value below 20

printf("\n\nThis is invalid information!\n\n");

exit(1);//Terminates program

printf("Enter Weight of Aircraft ------->");

scanf("%f",&property.weight);

if (property.weight<200)//User cannot enter value below 200

printf("\n\nThis is invalid information!\n\n");

exit(1);//Terminates program

printf("Enter the Engine of Aircraft -------->");

scanf("%s",&property.engine);

printf("Enter the Storage Duration of Aircraft(months) ---->");

scanf("%f",&property.Storageduration);

if (property.Storageduration<=0)//User cannot enter value below 0

{
printf("\n\nThis is invalid information!\n\n");

exit(1);//Terminates program

printf("Enter the Asset Worth of aircraft ---->");

scanf("%f",&property.AssetWorth);

if (property.AssetWorth<50000)//User cannot enter value below 50000

printf("\n\nThis is invalid information!\n\n");

exit(1);//Terminates program

//User chooses site to store aircraft

printf("Enter Location of Aircraft ------------------->\n\n");

printf("\t1 Meadow Gardens Warehouse 117-Christ Church\n\n");

printf("\t Transportation Cost---->$2590.00\n");

printf("\t Storage Rate------>$980.00\n\n\n");


printf("\t2 Greenfield Building 3C-Saint Lucy\n\n");

printf("\t Transportation Cost---->$4122.00\n");

printf("\t Storage Rate------>$600.00\n\n\n");

printf("\t+++++++++++++++++++++++++++++++++++++++++++++++++\n\n");

printf("\t+++++++++++++++++++++++++++++++++++++++++++++++++\n\n");

printf("\t3 Wharf Road Warehouse 9B-Bridgetown\n\n");

printf("\t Transportation Cost---->$2600.00\n");

printf("\t Storage Rate------>$800.00\n\n\n");

printf("\t+++++++++++++++++++++++++++++++++++++++++++++++++\n\n");

scanf("%d",&property.Location);

if(property.Location==1)

if (Facility1!=2)

Facility1=Facility1+1;
property.TransportCost=2590.00;

property.StorageFee=StorageRate1*property.Storageduration+(0.1*(UtilCost1+EmployCost1+Tax1));

TotalAssetCC=TotalAssetCC+property.AssetWorth;

TotalRevenueCC=TotalRevenueCC+property.StorageFee+property.TransportCost;

}//END IF

else

printf("That storage facility is full, we are sorry for this inconvenience\n Please enjoy your
day!");//This location is full

exit(1);//Terminates program

}//END ELSE

}//END IF

else

if (property.Location==2)

if (Facility2!=2)

Facility2=Facility2+1;

property.TransportCost=4122.00;

property.StorageFee=StorageRate2*property.Storageduration+(0.1*(UtilCost2+EmployCost2+Tax2));

TotalAssetSL=TotalAssetSL+property.AssetWorth;
TotalRevenueSL=TotalRevenueSL+property.StorageFee+property.TransportCost;

}//END IF

else

printf("That storage facility is full, we are sorry for this inconvenience\n Please enjoy your
day!");//This location is full

exit(1);//Terminates program

}//END ELSE

}//END IF

else

if (property.Location==3)

if (Facility3!=2)

Facility3=Facility3+1;

property.TransportCost=2600.00;

property.StorageFee=StorageRate3*property.Storageduration+(0.1*(UtilCost3+EmployCost3+Tax3));

TotalAssetBT=TotalAssetBT+property.AssetWorth;

TotalRevenueBT=TotalRevenueBT+property.StorageFee+property.TransportCost;
}//END IF

else

printf("That storage facility is full, we are sorry for this inconvenience\n Please enjoy your
day!");//This location is full

exit(1);//Terminates program

}//END ELSE

}//END IF

else

//ERROR-HANDLING

if((property.Location!=1)&&(property.Location!=2)&&(property.Location!=3))

printf("THIS IS INVALID NFORMATION");

exit(1);//Terminates program

}//END IF

fseek(inDataFile1,(property.id-1)*sizeof(struct AircraftInfo),SEEK_SET);

fwrite(&property,sizeof(struct AircraftInfo),1,inDataFile1);

fclose(inDataFile1);
system("Pause");

void ViewInfo()//VIEWING INFORMATION IN RECORDS

FILE*inDataFile1;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");

}//END IF

else

printf("============================================================\n\n ");

printf(" \t\tVIEW RECORDS \n\n");

printf("============================================================\n\n");

/*read and display every line in the file*/

while(!feof(inDataFile1))
{

fread(&property,sizeof(struct AircraftInfo),1,inDataFile1);

if(property.id!=0)

printf("ID Number ---->%d\n\n",property.id);

printf("Model Name ---->%s\n",property.model_name);

printf("Customer ---->%s\n",property.customer_name);

printf("Model Number ---->%d\n",property.modelnumber);

printf("Height ---->%.2f metres \n",property.height);

printf("Length ---->%.2f metres\n",property.length);

printf("Wingspan ---->%.2f metres \n\n",property.wingspan);

printf("Weight ---->%.2f kilograms\n",property.weight);

printf("Engine ------>%s\n\n",property.engine);

printf("Asset Worth ---->$%.2f\n",property.AssetWorth);

printf("Storage Duration---->%.2f Months\n\n",property.Storageduration);

printf("The Transportation Cost for this aircraft is $%.2f\n",property.TransportCost);

printf("The Storage Fee for this Aircraft per month is $%.2f\n\n",property.StorageFee);

if (property.Location==1)

printf(" This aircraft is stored at Meadow Garden Warehouse 117-Christ Church\n");


}//ENDIF

else

if (property.Location==2)

printf("This aircraft is stored at Greenfield Building 3C-Saint Lucy\n");

}//ENDIF

else

if (property.Location==3)

printf("This aircraft is stored at Wharf Road Warehouse 9B-Bridgetown\n");

}//ENDIF

printf("\n\n\n");

printf("============================================================\n\n \n");

}//END IF

}//END WHILE
}//END ELSE

fclose(inDataFile1);

system("Pause");

void Search()//SEARCHING FOR RECORD

FILE*inDataFile1;

int searchid;

int result;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");

result=MenuChoice();
}//END IF

else

printf("SEARCH RECORDS");

printf("Enter desired Identification Number\n");

scanf("%d",&searchid);

fseek(inDataFile1,(searchid-1)*sizeof(struct AircraftInfo),SEEK_SET);

fread(&property,sizeof(struct AircraftInfo),1,inDataFile1); /*Read Mode*/

if(property.id!=0)

if (searchid==property.id)

printf("ID Number ---->%d\n\n",property.id);

printf("Model Name ---->%s\n",property.model_name);


printf("Customer ---->%s\n",property.customer_name);

printf("Model Number ---->%d\n",property.modelnumber);

printf("Height ---->%.2f metres \n",property.height);

printf("Length ---->%.2f metres\n",property.length);

printf("Wingspan ---->%.2f metres \n\n",property.wingspan);

printf("Weight ---->%.2f kilograms\n",property.weight);

printf("Engine ------>%s\n\n",property.engine);

printf("Asset Worth ---->$%.2f\n",property.AssetWorth);

printf("Storage Duration---->%.2f Months\n\n",property.Storageduration);

printf("The Transportation Cost for this aircraft is $%.2f\n",property.TransportCost);

printf("The Storage Fee for this Aircraft per month is $%.2f\n\n",property.StorageFee);

if (property.Location==1)

printf(" This aircraft is stored at Meadow Garden Warehouse 117-Christ Church\n");

else

if (property.Location==2)

printf("This aircraft is stored at Greenfield Building 3C-Saint Lucy\n");

else
if (property.Location==3)

printf("This aircraft is stored at Wharf Road Warehouse 9B-Bridgetown\n");

}//ENDIF

if(property.id==0)

printf(" !!!!!!RECORD DOES NOT EXIST!!!!!! \n\n");

//END IF

fclose(inDataFile1);

system("Pause");
}//END ELSE

}//ENDIF

void UpdateRecord()//Updating Information

FILE*inDataFile1;

int identification;

int result;

int upchoice;

float heightamount;

float lengthamount;

float wingspanamount;

float weightamount;

float assetworthamount;

float storageamount;

float UtilCost1=1200.75;

float EmployCost1=30000.00;

float Tax1=5600.0;

float StorageRate1=20000.50;
float UtilCost2=370.00;

float EmployCost2=15000.00;

float Tax2=1000.00;

float StorageRate2=40000.00;

float UtilCost3=2300.50;

float EmployCost3=18900.75;

float Tax3=1500.00;

float StorageRate3=37500.50;

float TotalRevenueCC=0.0;

float TotalRevenueSL=0.0;

float TotalRevenueBT=0.0;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");

result=MenuChoice();

}//END IF

else

printf("Enter Asset ID to update(1 to 100)--->");


scanf("%d",&identification);

fseek(inDataFile1,(identification-1)*sizeof(struct AircraftInfo),SEEK_SET);

fread(&property,sizeof(struct AircraftInfo),1,inDataFile1); /*Read Mode*/

if(property.id==0)

printf(" !!!!!!RECORD HAS NO INFORMATION!!!!!! \n\n");

}//END IF

if(property.id!=0)

printf("\n\nID Number ---->%d",property.id);

printf("Model Name ---->%s",property.model_name);

printf("Customer ---->%s",property.customer_name);

printf("Model Number ---->%d",property.modelnumber);

printf("Height ---->%.2f metres ",property.height);

printf("Length ---->%.2f metres",property.length);

printf("Wingspan ---->%.2f metres ",property.wingspan);

printf("Weight ---->%.2f kilograms",property.weight);

printf("Engine -------->%s",property.engine);

printf("Asset Worth ---->$%.2f",property.AssetWorth);


printf("Storage Duration---->%.2f Months ",property.Storageduration);

printf("OPTION DESCRIPTION \n\n");

printf("1 Update Height\n");

printf(" 2 Update Length\n");

printf(" 3 Update Wingspan\n");

printf(" 4 Update Weight\n");

printf(" 5 Update Asset Worth\n");

printf(" 6 Update Storage Duration\n");

printf(" 7 Abort Update\n");

printf("Task=====>");

scanf("%d",&upchoice);

while(upchoice!=7)
{

if (upchoice==1)

printf(".......Updating Height......");

printf("Enter increase(+) or decrease(-)--------->\n");

scanf("%f",&heightamount);

property.height=property.height+heightamount;

if (property.height<5)

property.height=property.height-heightamount;

printf("This update cannot be completed! Invalid Information!\n\n");

break;

else

break;

}//END OF HEIGHT UPDATE


if (upchoice==2)//LENGTH UPDATE

printf(".......Updating Length......");

printf("Enter increase(+) or decrease(-)--------->\n");

scanf("%f",&lengthamount);

property.length=property.length+lengthamount;

if (property.length<20)

property.length=property.length-lengthamount;

printf("This update cannot be completed! Invalid Information!\n\n");

break;

else

break;

}//END OF LENGTH UPDATE

if (upchoice==3)//WINGSPAN UPDATE
{

printf(".......Updating Wingspan......");

printf("Enter increase(+) or decrease(-)--------->\n");

scanf("%f",&wingspanamount);

property.wingspan=property.wingspan+wingspanamount;

if (property.wingspan<20)

property.wingspan=property.wingspan-wingspanamount;

printf("This update cannot be completed! Invalid Information!\n\n");

break;

else

break;

}//END OF WINGSPAN UPDATE

if (upchoice==4)//WEIGHT UPDATE

{
printf(".......Updating Weight......");

printf("Enter increase(+) or decrease(-)--------->\n");

scanf("%f",&weightamount);

property.weight=property.weight+weightamount;

if (property.weight<200)

property.weight=property.weight-weightamount;

printf("This update cannot be completed! Invalid Information!\n\n");

break;

else

break;

}//END OF WEIGHT UPDATE

if (upchoice==5)//ASSET WORTH UPDATE

printf(".......Updating Asset Worth......");

printf("Enter increase(+) or decrease(-)--------->\n");


scanf("%f",&assetworthamount);

property.AssetWorth=property.AssetWorth+assetworthamount;

if (property.AssetWorth<50000)

property.AssetWorth=property.AssetWorth-assetworthamount;

printf("This update cannot be completed! Invalid Information!\n\n");

break;

else

break;

}//END OF ASSET WORTH UPDATE

if (upchoice==6)//STORAGE DURATION UPDATE

printf(".......Updating Storage Duration.....");

printf("Enter increase(+) or decrease(-)--------->\n");

scanf("%f",&storageamount);
property.Storageduration=property.Storageduration+storageamount;

if (property.Storageduration<1)

property.Storageduration=property.Storageduration-storageamount;

printf("This update cannot be completed! Invalid Information!\n\n");

break;

else

break;

}//END OF STORAGE DURATION UPDATE

if (upchoice==7)//ABORT UPDATE

printf("Update has been aborted!");

break;

if ((upchoice<1)||(upchoice>7))//ERROR-HANDLING

printf("Invalid Option!\n\n\n\n");
exit(1);

if (property.Location==1)

TotalRevenueCC=TotalRevenueCC-property.StorageFee;

property.StorageFee=StorageRate1*property.Storageduration+(0.1*(UtilCost1+EmployCost1+Tax1));

TotalRevenueCC=TotalRevenueCC+property.StorageFee;

else

if (property.Location==2)

TotalRevenueSL=TotalRevenueSL-property.StorageFee;

property.StorageFee=StorageRate2*property.Storageduration+(0.1*(UtilCost2+EmployCost2+Tax2));

TotalRevenueSL=TotalRevenueSL+property.StorageFee;

else

if (property.Location==3)

TotalRevenueBT=TotalRevenueBT-property.StorageFee;
property.StorageFee=StorageRate3*property.Storageduration+(0.1*(UtilCost1+EmployCost3+Tax3));

TotalRevenueBT=TotalRevenueBT+property.StorageFee;

printf("======================================================\n");

printf(" THE UPDATED RECORD \n");

printf("======================================================\n");

printf("ID Number ---->%d\n\n",property.id);

printf("Model Name ---->%s\n",property.model_name);

printf("Customer ---->%s\n",property.customer_name);

printf("Model Number ---->%d\n",property.modelnumber);

printf("Height ---->%.2f metres \n",property.height);

printf("Length ---->%.2f metres\n",property.length);

printf("Wingspan ---->%.2f metres \n\n",property.wingspan);

printf("Weight ---->%.2f kilograms\n",property.weight);

printf("Engine -------->%s\n\n",property.engine);

printf("Asset Worth ---->$%.2f\n",property.AssetWorth);

printf("Storage Duration---->%.2f Months\n\n",property.Storageduration);

printf("The Transportation Cost for this aircraft is $%.2f\n",property.TransportCost);

printf("The Storage Fee for this Aircraft per month is $%.2f\n\n",property.StorageFee);


fseek(inDataFile1,(property.id-1)*sizeof(struct AircraftInfo),SEEK_SET);

fwrite(&property,sizeof(struct AircraftInfo),1,inDataFile1);

fclose(inDataFile1);

void Delete()//Deleting Records

FILE*inDataFile1;

int identification;

int result;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

struct AircraftInfo blankproperty={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");


result=MenuChoice();

}//END IF

else

printf(" DELETE RECORDS ");

printf("Enter Asset ID to delete(1 to 100)--->");

scanf("%d",&identification);

fseek(inDataFile1,(identification-1)*sizeof(struct AircraftInfo),SEEK_SET);

fread(&property,sizeof(struct AircraftInfo),1,inDataFile1);

if(property.id==0)

printf(" !!!!!!RECORD DOES NOT EXIST!!!!!! \n\n");

}//END IF

if(property.id!=0)

if (property.Location==1)

Facility1=Facility1-1;
TotalRevenueCC=TotalRevenueCC-(property.TransportCost+property.StorageFee);

TotalAssetCC=TotalAssetCC-property.AssetWorth;

else

if (property.Location==2)

Facility2=Facility2-1;

TotalRevenueSL=TotalRevenueSL-(property.TransportCost+property.StorageFee);

TotalAssetSL=TotalAssetSL-property.AssetWorth;

else

if (property.Location==3)

Facility3=Facility3-1;

TotalRevenueBT=TotalRevenueBT-(property.TransportCost+property.StorageFee);

TotalAssetBT=TotalAssetBT-property.AssetWorth;

fseek(inDataFile1,(property.id-1)*sizeof(struct AircraftInfo),SEEK_SET);

fwrite(&blankproperty,sizeof(struct AircraftInfo),1,inDataFile1);

printf("============================================================\n\n ");

printf(" \n\n\n\t\t\t DELETE COMPLETE \n\n");

printf("============================================================\n\n ");

}//END IF
fclose(inDataFile1);

system("Pause");

}//END ELSE

void ViewLocation()//Viewing Location Information

FILE*inDataFile1;

float UtilCost1=1200.75;

float EmployCost1=30000.00;

float Tax1=5600.0;

float UtilCost2=370.00;

float EmployCost2=15000.00;

float Tax2=1000.00;

float UtilCost3=2300.50;

float EmployCost3=18900.75;

float Tax3=1500.00;
float CCOpExp;

float SLOpExp;

float BTOpExp;

float CCNetIncome;

float SLNetIncome;

float BTNetIncome;

int input;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");

}//END IF

else

printf("OPTION DESCRIPTION \n\n");

printf("1 Meadow Garden Warehouse 117-Christ Church \n\n");

printf(" 2 Greenfield Building 3C-Saint Lucy\n\n");

printf(" 3 Wharf Road Warehouse 9B-Bridgetown \n\n");


printf("============================================================\n\n ");

printf(" \tLocation Information \n\n");

printf("============================================================\n\n");

printf("Enter the Location---->\n\n");

scanf("%d",&input);

if(input==1)

printf("\t Meadow Garden Warehouse 117-Christ Church\n");

printf("Number of Space(s) Occupied->%d\n",Facility1);

printf("Asset Worth in Storge ------>$%.2f\n\n",TotalAssetCC);

printf("Average Temperature ------->37 Degrees Celcius\n");

printf("Employees on Site ------->55 Permanet Employees\n");

printf(" ------->23 Temporary Employees\n");

printf(" ------->0 Interns\n");

printf("Salary Allocations ---->$%.2f \n\n",EmployCost1);


printf("Utility Cost of Property --->$%.2f\n",UtilCost1);

printf("Land and Property Tax ----->$%.2f\n\n",Tax1);

printf("Revenue generated -----> $%.2f\n",TotalRevenueCC);

CCOpExp=Tax1+EmployCost1+UtilCost1;

printf("Operating Expenses ----->$%.2f\n",CCOpExp);

CCNetIncome=TotalRevenueCC-CCOpExp;

printf("Net Income -------->$%.2f\n\n",CCNetIncome);

else

if (input==2)

printf("\tGreenfield Building 3C-Saint Lucy\n");

printf("Number of Space(s) Occupied->%d\n",Facility2);

printf("Asset Worth in Storge ------>$%.2f\n\n",TotalAssetSL);


printf("Average Temperature ------>42 Degrees Celcius\n");

printf("Employees on Site ------->23 Permanet Employees\n");

printf(" ------->0 Temporary Employees\n");

printf(" ------->2 Interns\n");

printf("Salary Allocations ---->$%.2f \n\n",EmployCost2);

printf("Utility Cost of Property --->$%.2f\n",UtilCost2);

printf("Land and Property Tax ----->$%.2f\n\n",Tax2);

printf("Revenue generated -----> $%.2f\n",TotalRevenueSL);

SLOpExp=Tax2+EmployCost2+UtilCost2;

printf("Operating Expenses ----->$%.2f\n",SLOpExp);

SLNetIncome=TotalRevenueSL-SLOpExp;

printf("Net Income -------->$%.2f\n\n",SLNetIncome);

else

if(input==3)

printf("\tWharf Road Warehouse 9B-Bridgetown\n");

printf("Number of Space(s) Occupied->%d\n",Facility3);

printf("Asset Worth in Storge ------>$%.2f\n\n",TotalAssetBT);


printf("Average Temperature ------->21 Degrees Celcius\n");

printf("Employees on Site ------->45 Permanet Employees\n");

printf(" ------->0 Temporary Employees\n");

printf(" ------->4 Interns\n");

printf("Salary Allocations ---->$%.2f \n\n",EmployCost3);

printf("Utility Cost of Property --->$%.2f\n",UtilCost3);

printf("Land and Property Tax ----->$%.2f\n\n",Tax3);

printf("Revenue generated -----> $%.2f\n",TotalRevenueBT);

BTOpExp=Tax3+EmployCost3+UtilCost3;

printf("Operating Expenses ----->$%.2f\n",BTOpExp);

BTNetIncome=TotalRevenueBT-BTOpExp;

printf("Net Income -------->$%.2f\n\n\n",BTNetIncome);

else

if((input>3)||(input<1))//ERROR-HANDLING

printf("Invalid Input!");

}
}//END ELSE

fclose(inDataFile1);

void Company()//VIEWING COMPANY FINANCIAL INFORMATION

FILE*inDataFile1;

float UtilCost1=1200.75;

float EmployCost1=30000.00;

float Tax1=5600.0;

float UtilCost2=370.00;

float EmployCost2=15000.00;

float Tax2=1000.00;

float UtilCost3=2300.50;

float EmployCost3=18900.75;

float Tax3=1500.00;

float CCOpExp;
float SLOpExp;

float BTOpExp;

float CCNetIncome;

float SLNetIncome;

float BTNetIncome;

float Expenses;

float Revenue;

float NetIncome;

float Assets;

struct AircraftInfo property={0,"","",0,0.0,0.0,0.0,0.0,"",0.0,0.0,0,0.0,0.0};

if ((inDataFile1 = fopen("myfile5", "rb+"))==NULL)

printf("Cannot open file \n");

}//END IF

else

printf(" \tCompany Financial Information \n");

printf("\tMeadow Garden Warehouse 117-Christ Church\n");

printf("\tAsset Worth in Storge ------->$%.2f\n",TotalAssetCC);


printf("\tRevenue generated ------> $%.2f\n",TotalRevenueCC);

CCOpExp=Tax1+EmployCost1+UtilCost1;

printf("\tOperating Expenses -------->$%.2f\n",CCOpExp);

CCNetIncome=TotalRevenueCC-CCOpExp;

printf("\tNet Income -------->$%.2f\n\n",CCNetIncome);

printf("\t Greenfield Building 3C-Saint Lucy\n");

printf("\tAsset Worth in Storge ------->$%.2f\n",TotalAssetSL);

printf("\tRevenue generated ------> $%.2f\n",TotalRevenueSL);

SLOpExp=Tax1+EmployCost1+UtilCost1;

printf("\tOperating Expenses -------->$%.2f\n",SLOpExp);

SLNetIncome=TotalRevenueSL-SLOpExp;

printf("\tNet Income -------->$%.2f\n\n",SLNetIncome);

printf("\n\t======================================\n\n\n");

printf("\tWharf Road Warehouse 9B-Bridgetown\n\n");


printf("\tAsset Worth in Storge ------->$%.2f\n",TotalAssetBT);

printf("\tRevenue generated ------>$%.2f\n",TotalRevenueBT);

BTOpExp=Tax1+EmployCost1+UtilCost1;

printf("\tOperating Expenses -------->$%.2f\n",BTOpExp);

BTNetIncome=TotalRevenueBT-BTOpExp;

printf("\t Income -------->$%.2f\n\n",BTNetIncome);

printf("\t=======================================\n");

Assets=TotalAssetCC+TotalAssetSL+TotalAssetBT;

Expenses=CCOpExp+SLOpExp+BTOpExp;

Revenue=TotalRevenueCC+TotalRevenueSL+TotalRevenueBT;

NetIncome=Revenue-Expenses;

system("Pause");

printf("\n\n");

printf("\t============================================");

printf("\n\n");

printf("\tFINANCIAL SUMMARY");

printf("\n\n");
printf("\t============================================\n\n");

printf("\tAsset Worth in Storage --------->$%.2f\n",Assets);

printf("\tTotal Operating Expenses ------->$%.2f\n",Expenses);

printf("\tTotal Revenue Generated ------->$%.2f\n\n\n",Revenue);

printf("\tNet Income-------------------->$%.2f\n\n",NetIncome);

fclose(inDataFile1);

}//END ELSE

main()//MAIN PROGRAM
{

char pass[10];

printf("Enter a password\n\n");

scanf("%s",pass);

while (strcmp(pass,"WE")!=0)

printf("Invalid password!\nPlease enter the correct password \n\n");

scanf("%s",pass);

}//ENDIF

FILE*inDataFile1;//POINTER TO FILE

int identification,result,f;

float heightamount;

float lengthamount;

float wingspanamount;

float weightamount;

float assetworthamount;

float storageamount;
float UtilCost1=1200.75;

float EmployCost1=30000.00;

float Tax1=5600.0;

float StorageRate1=20000.50;

float UtilCost2=370.00;

float EmployCost2=15000.00;

float Tax2=1000.00;

float StorageRate2=40000.00;

float UtilCost3=2300.50;

float EmployCost3=18900.75;

float Tax3=1500.00;

float StorageRate3=37500.50;

float CCOpExp;

float SLOpExp;

float BTOpExp;

float CCNetIncome;

float SLNetIncome;

float BTNetIncome;

float Expenses;

float Revenue;

float NetIncome;

float Assets;

int searchid;
int input;

int upchoice;

result=MenuChoice();/*call to function MenuChoice*/

while(result!=9)

if(result==1)

CreateFile();

system("Pause");

result=MenuChoice();/*call to function MenuChoice*/

}//END IF

if(result==2)//PROMPT USER FOR INFO TO FILL RECORD

AddInfo();
result=MenuChoice();/*call to function MenuChoice*/

}//END IF

if(result==3)//VIEW RECORDS

ViewInfo();

result=MenuChoice();

}//END IF

if(result==4)//SEARCHING FOR RECORDS

Search();

result=MenuChoice();

}//END IF

if(result==5)//UPDATING RECORDS

UpdateRecord();

result=MenuChoice();/*call to function MenuChoice*/


}//END IF

if(result==6)//DELETING RECORDS

Delete();

result=MenuChoice();

}//END IF

if(result==7)//VIEW LOCATION

ViewLocation();

result=MenuChoice();

if(result==8)//VIEW COMPANY FINANCIAL STATISTICS

Company();

result=MenuChoice();

}//END IF

if(result==9) //EXITING PROGRAM

system("pause");

}//END IF
if((result>9)||(result<=0))//ERROR-HANDLING

printf("\t\t\tInvalid Input!");

system("Pause");

result=MenuChoice();

} //END WHILE

}//END MAIN

Potrebbero piacerti anche