#include <stdio.h>
#include <iostream.h>
#include <conio.h>
void main()
{
char nama[20],kereta[10],jur,kode;
int jmltiket,harga;
float disc,total;
gotoxy(20,2);printf("PENDATAAN TIKET KERETA API");
gotoxy(20,3);printf("-----------------------------");
gotoxy(20,5);printf("1. Kode Tiket :");gotoxy(45,5);scanf("%s",&kode);
gotoxy(20,6);printf("2. Nama Pelanggan :");gotoxy(45,6);scanf("%s",&nama);
gotoxy(20,7);printf("3. Jenis Tiket [1..4] : Jurusan :");gotoxy(45,7);scanf("%s",&jur);
switch(jur)
{
case '1' :
gotoxy(60,7);printf("Jakarta");
harga=300000;
strcpy(kereta,"Argo Anggrek");
break;
case '2' :
gotoxy(60,7);printf("Surabaya");
harga=250000;
strcpy(kereta,"Argo Sembrani");
break;
case '3' :
gotoxy(60,7);printf("Yogyakarta");
harga=200000;
strcpy(kereta,"Pandan Wangi");
break;
case '4' :
gotoxy(60,7);printf("Bandung");
harga=275000;
strcpy(kereta,"Harina");
break;
default :
gotoxy(60,7);printf("Salah Memasukan Kriteria");
break;
}
gotoxy(20,8);printf("4. Nama Kereta :%s ",kereta);
gotoxy(20,9);printf("5. Harga Tiket : %d ", harga);
gotoxy(20,10);printf("7. Jumlah Tiket :");gotoxy(45,10);scanf("%s",&jmltiket);
total=(jmltiket*harga);
gotoxy(20,11);printf("8. Total :%4.2f ", total);
gotoxy(20,13);printf("9. Discount :");gotoxy(45,13);scanf("%4.2f",&disc);
if (total<=1000000)
disc=0.1*total;
else
if (total>1000000)
disc=0.15*total;
if (total>=2500000)
disc=0.15*total;
else
disc=0.2*total;
gotoxy(20,14);printf("10. Jumlah Bayar :%4.2f ",disc);
getch();
}
Langganan:
Posting Komentar (Atom)
0 Response to "Ujian Semeter Dasar Pemprograman"
Posting Komentar