Recent Comments

Space For Ads

Space For Ads

Rabu, 03 November 2010

Contoh Program Pascal

program minipos;
uses crt;
 label
 start,finish;
  var
  name,code,symbols,size:string[20];
  qty,price,totprice:longint;
  bill,payment,discount,cashback:real;
  next:char;
  begin
   clrscr;
    write('Name                       : ');readln(name);
    write('Category [Shirt / T-Shirt] : ');readln(code);
    write('Size [S/M/L]               : ');readln(symbols);
    write('Quantity                   : ');readln(qty);

    if code='Dress Shirt'then
     begin
     symbols:='S';
     size:='Small';
     price:=100000;
     end
      else if code='Dress Shirt'then
       begin
       symbols:='M';
       size:='Medium';
       price:=150000;
       end
        else
         begin
         symbols:='L';
         size:='Large';
         price:=200000;
         end;
     if code='T-Shirt' then
      begin
      symbols:='S';
      size:='Small';
      price:=300000;
      end
       else if code='T-Shirt' then
        begin
        symbols:='M';
        size:='Medium';
        price:=350000;
        end
        else
         begin
         symbols:='L';
         size:='Large';
         price:=400000;
         end;
     if symbols='S' then
      symbols:='Small'
       else if
        symbols='M' then
         symbols:='Medium'
         else if symbols='L' then
         symbols:='Large'
          else
          symbols:='Null';
     totprice:=qty*price;
      if qty>5 then
       discount:=0.15*totprice
        else
         discount:=0;
     bill:=totprice-discount;
      writeln('###### Butik ID ######');
      writeln('Clothes     : ',code);
      writeln('Size        : ',size);
      writeln('Quantity    : ',qty);
      writeln('Total Price : Rp. ',totprice);
      writeln('-------------------------');
      writeln('Billing     : Rp. ',bill:2:0);
      write('Payment       : Rp. ');readln(payment);
       cashback:=payment-bill;
      writeln('Cash back   : Rp. ',cashback:2:0);
     readln;
end.

0 komentar:

Posting Komentar