I need help in coding for turbo c++ in my assignment.
I need help please with my assignment in turbo c++ language. I only had a very basic knowledge with turbo C++. I had attach together with my doc. Please programmer help me. thank you.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
KimPosted Apr 2, 2013, 1:06 PM
I wondering that if u still have the complete coding for the assignment that you have done on the car renewal system with turbo C++.
Would you kindly email to it to me? Thanks n regards..
klement chiaPosted Apr 6, 2011, 9:35 AM
main()
{
char date1[10], date2[10], mth1[5], mth2[5];
char months[][5] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
int k, m;
printf("Enter first date: ");
gets(date1);
printf("Enter second date: ");
gets(date2);
mth1[0] = date1[0];
mth1[1] = date1[1];
mth1[2] = date1[2];
mth1[3] = '\0';
for (k=0;k<12;k++)
if(strcmp(mth1, months[k]) ==0)
break;
mth2[0] = date2[0];
mth2[1] = date2[1];
mth2[2] = date2[2];
mth2[3] = '\0';
for (m=0;m<12;m++)
if(strcmp(mth2, months[m]) ==0)
break;
if(k < m )
printf("date 1 is less than date 2");
else if(k == m)
printf("both date are equal");
else
printf("date1 is greater than date 2");
}
klement chiaPosted Apr 6, 2011, 9:31 AM
its using turbo C++.
Problem:
An established car rental firm in town offers a wide range of vehicles for rent to its customers. As the size of its fleet of vehicles got larger through the years the manager would like a software system that could inform him which vehicles need their road tax renewed for a particular month. Design and develop a software system using C++ that could help solve this problem.
Screen 1:
This screen displays the main menu which consists of ADD VEHICLE, VEHICLE ENQUIRY, ROAD TAX RENEWAL REPORT, INTIALISE DATABASE and EXIT. You are required to incorporate any necessary validation checks and to design your own error messages.
Screen2:
This screen, ADD VEHICLE, with the field shown below, allows a new vechicle record to be created. The vechicle number which is an integer starting with 1 is to be determined by the operator. Put vehicle number 1 details into record 1; vehicle number 2 details into record 2 and so on. If the operator enters a vehicle number that already exists then display a warning message "Record exists…..overrite(y/n)". A random file called VECHICLE.DB is to be created.
The following checks should be made:
1. Vehicle number : integer.
2. Registration number :AAA9999 (eg. BA123)
3. Make :alphabets only (e.g. Ford)
4. Model :alphabets only(e.g. Model T)
5. Engine Type : D or P (diesel or Petrol)
6. Engine Capacity(cc) : 9999 (e.g. 2900)
7. Road tax expiry date : mmmm yyyy(e.g. May 1911)
Screen3:
This screen displays vechicle details, one vehicle record per screen. Display all details mentioned in screen 2 above. In addition, calculate and display (round up to whole number) the road tax amount ($2.25 per 100 cc).
Screen 4:
This is the ROAD TAX RENEWAL REPORT Module. This module needs to be run only once a month (usually mid-month) to print a report (on the screen) which shows those vehicles in which the road tax is expiring for that month. This is done by comparing the road tax expiry date with the system date. Design Your own report format.
The code I had done except screen 4 that I really need help:
main Menu:
main()
{
char val_choice;
char show_menu();
val_choice=show_menu();
return 0;
}
char show_menu()
{
char choice='0';
while(choice >'5' || choice <'1')
{
clrscr();
gotoxy(30,4);
cputs("========================================");
gotoxy(30,5);
cputs("Vehicle Tax");
gotoxy(30,6);
cputs("========================================");
gotoxy(30,7);
cputs("1. Add Vehicle");
gotoxy(30,8);
cputs("2. Vehicle Enquiry");
gotoxy(30,9);
cputs("3. Road Tax Renewal Report");
gotoxy(30,10);
cputs("4. Initialise Database");
gotoxy(30,11);
cputs("5. Exit");
gotoxy(30,13);
cputs("Enter choice: ");
choice=getchar();
if(choice>'5' || choice <'1')
{
gotoxy(30,16);
cputs("Invalid Choice. Please re-enter");
}
else
return(choice);
}
return 0;
}
SCREEN1
#include
struct vehicledata
{
int vehiclenum;
char registrationnum[10];
char make[10];
char model[10];
char enginetype[2];
int enginecapacity;
char rtmonth[4];
char rtyear[5];
}
vehicle = {0,"","","","",0,"",""};
main()
{
int i;
FILE *cfptr;
if((cfptr=fopen("vehicle.db", "w")) == NULL)
printf("File could not open.\n");
else
{
for(i=1; i<=12; i++)
fwrite(&vehicle, sizeof(struct vehicledata),1, cfptr);
clrscr();
printf("Database had been initialise!");
getch();
fclose(cfptr);
}
return 0;
}
SCREEN2
#include
#include
#include
struct vehicledata
{
int vehiclenum;
char registrationnum[10];
char make[10];
char model[10];
char enginetype[2];
int enginecapacity;
char rtmonth[4];
char rtyear[5];
}
vehicle= {0,"","","","",0,"",""};
main()
{
FILE *cfptr;
if((cfptr=fopen("vehicle.db", "r+")) == NULL)
printf("File could not open.\n");
else
while(1)
{
clrscr();
printf("Enter vehiclenum #(1-20, 0 to end): ");
scanf ("%d", &vehicle.vehiclenum);
if(vehicle.vehiclenum==0) break;
fflush(stdin);
printf("\n\nEnter registrationnum: ");
gets(vehicle.registrationnum);
fflush(stdin);
printf("\n\nEnter make: ");
add_make();
fflush(stdin);
printf("\n\nEnter model: ");
add_model();
fflush(stdin);
printf("\n\nEnter enginetype: ");
gets(vehicle.enginetype);
fflush(stdin);
printf("\n\nEnter enginecapacity: ");
scanf("%d", &vehicle.enginecapacity);
fflush(stdin);
printf("\n\nEnter rtmonth: ");
gets(vehicle.rtmonth);
fflush(stdin);
printf("\n\nEnter rtyear: ");
gets(vehicle.rtyear);
fseek(cfptr, (vehicle.vehiclenum)*sizeof(struct vehicledata), SEEK_SET);
fwrite(&vehicle, sizeof(struct vehicledata),1,cfptr);
}
fclose(cfptr);
return 0;
}
add_make()
{
int err=1, k;
while (err == 1)
{
start:
err=0;
gets(vehicle.make);
k=0;
while (vehicle.make[k] != '\0')
{
if (isdigit(vehicle.make[k]))
{
printf("Make must be in character, please re-enter: ");
err=1;
printf("");
goto start;
}
k=0;
while (vehicle.make[k] != '\0')
{
if (ispunct(vehicle.make[k]))
{
printf ("Invalid, please re-enter: ");
getch();
printf(" ");
err=1;
printf(" ");
goto start;
}
else
++k;
}
}
}
return;
}
add_model()
{
int err=1, k;
while (err == 1)
{
start:
err=0;
gets(vehicle.model);
k=0;
while (vehicle.model[k] != '\0')
{
if (isdigit(vehicle.model[k]))
{
printf("Make must be in character, please re-enter: ");
err=1;
printf("");
goto start;
}
k=0;
while (vehicle.model[k] != '\0')
{
if (ispunct(vehicle.model[k]))
{
printf ("Invalid, please re-enter: ");
getch();
err=1;
printf (" ");
printf (" ");
goto start;
}
else
++k;
}
}
}
return;
}
Screen 3:
#include
#include
struct vehicledata
{
int vehiclenum;
char registrationnum[10];
char make[10];
char model[10];
char enginetype;
int enginecapacity;
char rtmonth[4];
char rtyear[5];
}
vehicle;
main(){
FILE *cfptr;
int vehiclenum;
float roadtaxamount;
if((cfptr=fopen("vehicle.db","r"))==NULL)
printf("File could not open.\n");
else
while(1)
{
clrscr();
printf("Enter vehiclenum #(1-20, 0 to end): ");
scanf ("%d", &vehicle.vehiclenum);
if(vehicle.vehiclenum==0) break;
fseek(cfptr, (vehicle.vehiclenum)*sizeof(struct vehicledata), SEEK_SET);
fread(&vehicle, sizeof(struct vehicledata),1,cfptr);
printf("\n\nregistrationnum : %s ", vehicle.registrationnum);
printf("\n\nmake: %s", vehicle.make );
printf("\n\nmodel: %s", vehicle.model );
printf("\n\nenginetype: %s", vehicle.enginetype);
scanf("\n\nenginecapacity: %d", vehicle.enginecapacity);
printf("\n\Expired Date:", vehicle.rtmonth );
fflush(stdin);
printf("%s\n",vehicle.rtyear);
roadtaxamount= (2.25*vehicle.enginecapacity)/100;
printf("Road tax amount : $%.2f", roadtaxamount);
fflush(stdin);
}
fclose(cfptr);
return 0;
}
Screen4.
need help please
Karthikeyan AnbarasanPosted Apr 6, 2011, 8:09 AM