[sourcecode language="c"]
void PayPadang(float adult, float child){
pay = (adult*35000) + (child*25000);
printf("\n You must pay :Rp %.2f \n\n", pay);
printf("\n Thank you ^_^ \n\n");
printf(" Copyright @2013 Programmer Muslim \n");
printf("___________________________________________________________________________\n");
return;
}
[/sourcecode]
2. PayPekanbaru
[sourcecode language="c"]
void PayPekanbaru(float adult, float child){
pay = (adult*110000) + (child*55000);
printf("\n You must pay :Rp %.2f \n\n", pay);
printf("\n Thank you ^_^ \n\n");
printf(" Copyright @2013 Programmer Muslim \n");
printf("___________________________________________________________________________\n");
return;
}
[/sourcecode]
3. PayDumai
[sourcecode language="c"]
void PayDumai(float adult, float child){
pay = (adult*135000) + (child*65000);
printf("\n You must pay :Rp %.2f \n\n", pay);
printf("\n Thank you ^_^ \n\n");
printf(" Copyright @2013 Programmer Muslim \n");
printf("___________________________________________________________________________\n");
return;
}
[/sourcecode]
and then flowchart for this program :
Source code program :
[sourcecode language="c"]
#include
#include
#include
void PayPadang(float adult, float child);
void PayPekanbaru(float adult, float child);
void PayDumai(float adult, float child);
float pay;
int main(void){
int ad1, cl1;
int choice;
index:
printf("**********************************************************************\n");
printf("* Welcome to Travel Minang Maimbau Application *\n");
printf("**********************************************************************\n\n");
printf(" Product by : Rizki Syaputra _49013097 \n");
printf("______________________________________________________________________\n\n");
printf("Please Enter 1-5 for access this application \n");
printf("1.Rute Lintau - Padang and Padang - Lintau \n");
printf("2.Rute Lintau - Pekanbaru and Pekanbaru - Lintau \n");
printf("3.Rute Lintau - Dumai and Dumai - Lintau \n");
printf("4.Help \n");
printf("5.Exit \n");
printf("______________________________________________________________________\n");
printf("Please input number 1-5 :");
scanf_s("%d",&choice);
switch(choice){
case 1 :
printf("\n\n==================================================================\n");
printf("Travel Minang Maimbau Rute Lintau - Padang and Padang - Lintau \n\n");
printf("Please answers below question : \n\n");
printf("How many adult passenger ? ");
scanf_s("%d",&ad1);
printf("How many child passenger ? ");
scanf_s("%d",&cl1);
printf("\n____________________________________________________________________\n");
PayPadang(ad1,cl1);
system("pause");
break;
case 2 :
printf("\n\n==================================================================\n");
printf("Travel Minang Maimbau Rute Lintau - Pekanbaru and Pekanabru- Lintau \n\n");
printf("Please answers below question : \n\n");
printf("How many adult passenger ? ");
scanf_s("%d",&ad1);
printf("How many child passenger ? ");
scanf_s("%d",&cl1);
printf("\n____________________________________________________________________\n");
PayPekanbaru(ad1,cl1);
system("pause");
break;
case 3:
printf("\n\n==================================================================\n");
printf("Travel Minang Maimbau Rute Lintau - Pekanbaru and Pekanabru- Lintau \n\n");
printf("Please answers below question : \n\n");
printf("How many adult passenger ? ");
scanf_s("%d",&ad1);
printf("How many child passenger ? ");
scanf_s("%d",&cl1);
printf("\n____________________________________________________________________\n");
PayDumai(ad1,cl1);
system("pause");
break;
case 4 :
printf("\n\n==========================================================================================\n");
printf("Help\n");
printf("For use this application please press number 1 until number 5\n");
printf("1.Rute Lintau - Padang and Padang - Lintau \n");
printf("2.Rute Lintau - Pekanbaru and Pekanbaru - Lintau \n");
printf("3.Rute Lintau - Dumai and Dumai - Lintau \n");
printf("4.Help \n");
printf("5.Exit \n");
printf("Those are list of Price our travel : \n");
printf("1. Lintau Padang and padang - Lintau Rp 35000 for an adult and Rp 25000 for a child\n");
printf("2. Lintau Pekanbaru and Pekanbaru - Lintau Rp 110000 for an adult and Rp 55000 for a child\n");
printf("3. Lintau Dumai and Dumai - Lintau Rp 135000 for an adult and Rp 65000 for a child\n");
printf("\n\nThank you \n");
system("pause");
break;
case 5 :
exit;
break;
default:
goto index;
printf("Please press number 1 - 5 !\n");
break;
}
}
void PayPadang(float adult, float child){
pay = (adult*35000) + (child*25000);
printf("\n You must pay :Rp %.2f \n\n", pay);
printf("\n Thank you ^_^ \n\n");
printf(" Copyright @2013 Programmer Muslim \n");
printf("___________________________________________________________________________\n");
return;
}
void PayPekanbaru(float adult, float child){
pay = (adult*110000) + (child*55000);
printf("\n You must pay :Rp %.2f \n\n", pay);
printf("\n Thank you ^_^ \n\n");
printf(" Copyright @2013 Programmer Muslim \n");
printf("___________________________________________________________________________\n");
return;
}
void PayDumai(float adult, float child){
pay = (adult*135000) + (child*65000);
printf("\n You must pay :Rp %.2f \n\n", pay);
printf("\n Thank you ^_^ \n\n");
printf(" Copyright @2013 Programmer Muslim \n");
printf("___________________________________________________________________________\n");
return;
}
[/sourcecode]
Output Program :
Picture 1. Main Application
Picture 2. When press 5
Picture 3. Menu 1
Picture 4. Menu 2
Picture 5. Menu 3
Picture 6. Menu 4
Link Video :
https://www.youtube.com/watch?v=mYbXzkGnAKg&feature=youtu.be
0 komentar:
Posting Komentar