ads_header

How To Create A Simple Cashier Program In Turbo Pascal


How To Create A Simple Cashier Program In Turbo Pascal


Hello guys, on this occasion I will discuss about how to create a simple cashier program using Turbo Pascal. This tutorial may be good enough for new students of IT majors who are just beginning to train their algorithms.
however, I will review the lessons for a long time, so that friends who still get simple tutorials like this. Because it would be nice if we were looking for something that we thought might not exist. hahah





Okay, just start our tutorial, of course you have to open Turbo Pascal and create a new file. If done, just enter the following code sample

program cashier;
uses crt;
var price,qty,pay,total:integer;
name,code:string;
begin
clrscr;
writeln;
write('Enter Item Code = ');readln(code);
 if code = 'B01' then
  begin
  name := 'Shampoo';
  price:= 5000;
  end
 else if code = 'B02' then
  begin
  name := 'Toothpaste';
  price := 6000;
  end
 else
  begin
  name := 'Milk';
  price := 9000;
  end;
writeln('Item Name = ',name);
writeln('Price Name = ',price);
writeln;
write('Enter Qty = ');readln(qty);
total:= price*qty;
writeln('Total price = ',total);
writeln;
write('Enter Payment = ');readln(pay);
 if pay >= total then
  begin
  writeln('Your Return = ',pay-total);   
  end
 else
  writeln('Your debt = ',total-pay);
  writeln;
  writeln('Thank you welcome back');
readkey;
end.

PROGRAM PROCEDURES:

  1. You will enter the item code, and in the example above I only make 3 types of items code that is B01, B02 da B03.
  2. If you enter B01, then automatically the name of your item is Shampoo and the price is worth 5000. If B02 the name of the item Toothpaste and the price is 6000. If in addition to these two codes, automatically the code will be worth B03 which means the name of Milk and the price is 9000.
  3. After that it will immediately look / printed the name of item and the price of item.
  4. Then you will enter the amount of item you want to buy.
  5. Then the total variable is worth the price of item * quantity of item. and will directly printed on the screen value of the total variable.
  6. Next you will enter the payment amount.
  7. If your payment is equal to or more than the total price, then you will see the amount of your return on the screen. If not, then you will see your debt squeeze on the screen.


The above program is quite simple and very suitable for beginners who want to train the logic programming.

For more details, please watch the video below



Powered by Blogger.