text maarque kanan

INGATKAN DIRIMU UNTUK MENGATUR SEGALA SESUATU SUDAH DI ATUR ALLOH

salju

Minggu, 16 Oktober 2011

Digital Counter


Program digital_counter;
uses wincrt;

label awal;
const
days : array [0..6] of string[9] =
     ('minggu','senin','selasa','rabu','kamis','jumat','sabtu');

var
operator,i,j,u,y,m,d,dow : integer;
uang,harga, pulsa,pilihan,c        : longint;
hp                : string;

{pernghitungan uang-harga}
function hitung(a,b : longint):longint;
begin
  hitung:= b-a
end;

procedure simpati(var pulsa:longint);
label simpati1;
var nominal : longint;
begin
  clrscr  ;
  simpati1:
  writeln('daftar harga SIMPATI');
  writeln('v 5   =====     6.000');
  writeln('v 10  =====    12.000');
  writeln('v 20  =====    21.000');
  writeln('v 50  =====    50.000');
  writeln('v 100 =====    98.000');
  writeln;
  writeln('masukkan nominal pulsa');
  readln (nominal);
  case nominal of
    5  : pulsa := 6000;
    10 : pulsa := 12000;
    20 : pulsa := 21000;
    50 : pulsa := 50000;
    100: pulsa := 98000;
    else begin
      pulsa := 0;
      writeln ('salah, tulis nominal');
      goto simpati1;
    end;
  end;
end;

procedure as(var pulsa:longint);
label as1;
var nominal : longint;
begin
  as1:
  writeln('daftar harga Kartu As');
  writeln('v 5   =====     6.000');
  writeln('v 15  =====    18.000');
  writeln('v 25  =====    29.000');
  writeln('v 50  =====    54.000');
  writeln('v 100 =====   108.000');
  writeln;
  writeln('masukkan nominal pulsa');
  readln (nominal);
  case nominal of
    5  : pulsa := 6000;
    15 : pulsa := 18000;
    25 : pulsa := 29000;
    50 : pulsa := 54000;
    100: pulsa := 108000;
    else begin
      pulsa := 0;
      writeln ('salah, tulis nominal');
      goto as1;
    end;
  end;
end;

procedure MENTARI(var pulsa:longint);
label im31;
var nominal : longint;
begin
  im31:
  writeln('daftar harga MENTARI');
  writeln('v 5   =====     6.000');
  writeln('v 10  =====    11.000');
  writeln('v 20  =====    21.000');
  writeln('v 50  =====    50.000');
  writeln('v 100 =====    98.000');
  writeln;
  writeln('masukkan nominal pulsa');
  readln (nominal);
  case nominal of
    5  : pulsa := 6000;
    10 : pulsa := 11000;
    20 : pulsa := 21000;
    50 : pulsa := 50000;
    100: pulsa := 98000;
    else begin
      pulsa := 0;
      writeln ('salah, tulis nominal');
      goto im31;
    end;
  end;
end;

procedure im3(var pulsa:longint);
label im32;
var nominal : longint;
begin
  im32:
  writeln('daftar harga im3');
  writeln('v 5   =====     6.000');
  writeln('v 10  =====    11.000');
  writeln('v 20  =====    20.000');
  writeln('v 50  =====    48.000');
  writeln('v 100 =====    95.000');
  writeln;
  writeln('masukkan nominal pulsa');
  readln (nominal);
  case nominal of
    5  : pulsa := 6000;
    10 : pulsa := 11000;
    20 : pulsa := 20000;
    50 : pulsa := 48000;
    100: pulsa := 95000;
    else begin
      pulsa := 0;
      writeln ('salah, tulis nominal');
      goto im32;
    end;
  end;
end;

procedure XL(var pulsa:longint);
label xl1;
var nominal : longint;
begin
xl1:
writeln('daftar harga XL');
writeln('v 5   =====     6.000');
writeln('v 10  =====    11.000');
writeln('v 20  =====    21.000');
writeln('v 50  =====    47.000');
writeln('v 100 =====    95.000');
writeln;
writeln('masukkan nominal pulsa');
readln (nominal);

case nominal of
5  : pulsa := 6000;
10 : pulsa := 11000;
20 : pulsa := 21000;
50 : pulsa := 47000;
100: pulsa := 95000;
else begin
     pulsa := 0;
     writeln ('salah, tulis nominal');
     goto xl1;
     end;
 end;
end;

{program utama}
begin
  {GetDate(y,m,d,dow : word); }
  {program untuk menampilkan date belum bisa keluar...
  bantuin dounk masss....}

  awal:
  for j:=7 to 11 do
  begin
    for i:=1 to j do
    write('=');
    writeln;
  end;
  writeln('================================');
  writeln('********************************');
  writeln('                                ');
  writeln('selamat datang di counter digital');
  writeln('                                 ');
  writeln;
  writeln('********************************');
  writeln('================================ ');

  for j:=11 downto 7 do
  begin
    for i:=1 to j do
    write('=');
    writeln;
  end;
  writeln('                       zen design');
  readln;
  clrscr;
  writeln('================================');
  writeln('********************************');
  writeln('                                ');
  writeln('    kami ada untuk anda         ');
  writeln('tekan    enter    untuk  memulai ');
  writeln('transaksi  anda');
  writeln('********************************');
  writeln('================================ ');

  readln;
  clrscr;

  writeln('1. Telkomsel');
  writeln('2. Indosat');
  writeln('3. XL');
  writeln;
  writeln('silahkan pilih operator anda');
  readln (operator);
  clrscr;

  case operator of
    1 :
      begin
        writeln('1. Simpati');
        writeln('2. Kartu As');
        readln (pilihan);
        clrscr;
        case pilihan of
          1 : simpati(pilihan); {memanggil procedure simpati}
          2 : as(pilihan);    {mamanggil procedure as}
        end;
      end;
    2 :
      begin
        writeln('1. MENTARI');
        writeln('2. im3');
        readln (pilihan);
        clrscr;
        case pilihan of
          1 : MENTARI(pilihan);
          2 : im3(pilihan);
        end;
      end;
    3 :
      begin
         readln (pilihan);
         XL(pilihan);
         clrscr;
      end
 else begin
      writeln ('maaf anda salah pilih');
      goto awal; {mengembalikan program ke label awal}

      end;
 end;

clrscr;
writeln ('masukan nomer hepe'); readln(hp);    {input nomer hape}
clrscr;

writeln ('masukkan uang anda'); readln (uang); {input uang}
clrscr;

if uang > pilihan then
   begin
    harga:=hitung(pilihan,uang);    { memanggil fungsi hitung}
    writeln('=============================');
    writeln('           BERHASIL ');
    writeln;
    writeln('transaksi ke nomor  ',hp);
    writeln('');
    writeln('sisa uang anda Rp.',harga);
    writeln('============================');

    while harga > 6000 do       {6000 adalah harga minimal voucher}
    begin                      {supaya pelanggan dapat melakukan trakdaksi lagi}
    writeln('saldo anda masih bisa untuk melanjutkan transaksi');
    readln(u);
    goto awal;
    end;

    writeln(days[dow],',',m:0,'/',d:0,'/',y:0); {yang ini belum bisa ditampilkan.. bantuin dounk mass}
   end
   else begin
    writeln('=========================');
    writeln('    TRANSAKSI GAGAL');
    writeln('saldo anda tidak mencukupi');
    writeln('==========================');
    writeln;
    writeln('     TERIMA KASIH');
   end;
end.

Tidak ada komentar:

Posting Komentar