Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

#include<iostream.h> #include<conio.

h> void farewell(); double roadtaxRenewal(int,int); double lisenceRenewal(int); double autoInsuranceRenewal(float); double summonCalculator(); double takafulInsurance(int); void greeting(); int main() { char name[40]; char ic[40]; long choice; int cc,year; int i=1; double totalprice,price,total; greeting(); cout<<endl<<endl; cout<<"Enter your name:"; cin.getline(name,39); cout<<"Enter your ic number:"; cin.getline(ic,39); cout<<"Enter your choice,-1 to exit:"; cin>>choice; cout<<endl; while (choice!=-1) { if (choice==1) { cout<<"Enter the CC of your car:"; cin>>cc; cout<<"you want to renew your roadtax for how many years?:"; cin>>year; totalprice=roadtaxRenewal(cc,year); cout<<" ***Roadtax renewal*** "<<endl; cout<<"Name :"<<name<<endl; cout<<"IC numbers :"<<ic<<endl; cout<<"The amount you must to pay is:"<<totalprice<<endl; cout<<endl; } if (choice==2) { cout<<"you want to renew your lisence for how many years? maximum is 3 y

ears:"; cin>>year; totalprice=lisenceRenewal(year); cout<<" ***Lisence Renewal*** "<<endl; cout<<"Name :"<<name<<endl; cout<<"IC numbers :"<<ic<<endl; cout<<"The amount you must to pay is:"<<totalprice<<endl; cout<<endl; } if (choice==3) { cout<<"Enter the price of your car:RM"; cin>>price; totalprice=autoInsuranceRenewal(price); cout<<" ***Insurance renewal*** "<<endl; cout<<"Name :"<<name<<endl; cout<<"IC numbers :"<<ic<<endl; cout<<"The amount you must to pay is:"<<totalprice<<endl; cout<<endl; } if (choice==4) { totalprice=summonCalculator(); cout<<" ***SummonCalculator*** "<<endl; cout<<"Name :"<<name<<endl; cout<<"IC numbers :"<<ic<<endl; cout<<"The amount you must to pay is:"<<totalprice<<endl; cout<<endl; } if (choice==5) { int month; cout<<"Enter how many month you want to renew your insurance:"; cin>>month; totalprice=takafulInsurance(month); cout<<" ***Takaful insurance*** "<<endl; cout<<"Name :"<<name<<endl; cout<<"IC numbers :"<<ic<<endl; cout<<"The amount you must to pay is:"<<totalprice<<endl; cout<<endl; } cout<<"Enter your choice,-1 to exit:"; cin>>choice; } farewell ();

getch(); return 0; }

void greeting() { cout<<" ***WELCOME TO UITM AUTO SERVICES ***"<<endl; cout<<endl<<endl; cout<<"Key cout<<"Key cout<<"Key cout<<"Key cout<<"Key } double roadtaxRenewal(int cc,int year) { double totalprice; if (cc>=2000) totalprice=year*90; if (cc>=1500&&cc<2000) totalprice=year*70; if (cc>=850&&cc<1500) totalprice=year*50; else totalprice=year*30; return totalprice; } double lisenceRenewal(int year) { double totalprice; char location; cout<<"Enter your location"<<endl; cout<<"P for peninsular malaysia"<<endl; cout<<"S for sabah sarawak"<<endl; cin>>location; while (year!=3&&year!=2&&year!=1) { cout<<"INVALID INPUT"<<endl; cout<<"PLEASE INPUT AGAIN"<<endl; cout<<"you want to renew your lisence for how many years?maximum is 3 ye ars:"; cin>>year; } in in in in in 1 2 3 4 5 to choose renew roadtax"<<endl; to choose renew license"<<endl; to choose renew auto insurance"<<endl; to choose calculate your summon"<<endl; to choose renew takaful insurance"<<endl;

if (year==1) totalprice=30.00; if (year==2) totalprice=60.00; if (year==3) totalprice=90.00; if (location=='P') totalprice=6.0+totalprice; if (location=='S') totalprice=10.0+totalprice; return totalprice; } double autoInsuranceRenewal(float price) { double totalprice; totalprice=price/1000; totalprice=(totalprice-1)*(26+251.50); return totalprice; } double summonCalculator() { int num; double totalprice=0; cout<<"please choose your guilt, enter -2 to exit"<<endl; cout<<"Key in 1 for Speed Trap"<<endl; cout<<"Key in 2 for Cross Double line"<<endl; cout<<"Key in 3 for Parking summon"<<endl; cout<<"Else key in 4 for others summon"<<endl; cin>>num; while (num!=-2) { if (num==1) totalprice=totalprice+300; if (num==2) totalprice=totalprice+200; if (num==3) totalprice=totalprice+50; if (num==4) totalprice=totalprice+100; cout<<"please choose your guilt, enter -2 to exit"<<endl; cin>>num;

} return totalprice; } double takafulInsurance(int month) { double totalprice; totalprice = month * 100; return totalprice; } void farewell() { cout<<"THANK YOU FOR USING UITM AUTO SERVICES"<<endl; cout<< Hope you will use it again <<endl; }

You might also like