PASCAL LOGISTICS PROGRAMMING -(A simple example)

September 2, 2015 | Views: 4325

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

– Introduction from the Programmer –

This program is a simple program for the employees payment from the logistics section.

We suppose that the currency is  in Euro and we dont focus on how the national tax system is

on 40 Euro or in 100 Euro.

Its a typical example to understand how programming is getting done with a language

like Pascal.


PROGRAM LOGISTICS(INPUT,OUTPUT);

CONST  TAX=40;

PAYDAY=30;

OVERTIME=30;

VAR SAL,WORKDAYS,OVERMONTH:INTEGER;

BEGIN

WRITELN(‘HOW MANY DAYS DID YOU WORK THIS MONTH ? ‘);

READLN(WORKDAYS);

WRITELN(‘HOW MANY WERE YOUR OVERTIMES ?’);

READLN(OVERTIMES);

SAL:=(PAYDAY*WORKDAYS)+(OVERTIME*OVERMONTH)-TAX;

WRITELN;WRITELN;

WRITE(‘YOUR SALARY THIS MONTH IS’,SAL, ‘ EURO .’);

END.

 

——————————————————————————————————————————————————————————————————————————————————————– -Code Explanation-

 

At the first line we type the keyword PROGRAM followed by parenthesis and the keywords

in the parenthesis INPUT separated with a comma and OUTPUT and at the end of the line

the Greek questionmark.This means that every program in Pascal is starting with the keyword

PROGRAM and it will be INPUT from the keyboard and OUTPUT from the screen .

Right after we declare Constants and Variables .We declare three Constants ,Tax Payday

and Overtimes (overhours) and we give the corresponding values .

We declare constants with the keyword CONST(command)and variables with the keyword

VAR .They both correspond in INTEGER type numbers .

In the variables section we declare three variables.SAL (salary) which is the solution of the

problem we are looking for ,WORKDAYS ,(the days this employee  worked this month ,

and OVERMONTH(the sum of EXTRA days that worked this month corresponding

to OVERTIME which means the extra working days .

After the first four lines we type the keyword BEGIN to start the body of the program which

IN IT there is the main program.

Right after with WRITELN we ask how many days he worked (LN means that we leave

an empty new line)and READ for giving input from the keyboard .We ask also how many

were your OVERTIMES with WRITELN and READLN .(how many extra days he worked.)

After INPUT and OUTPUT Commands (WRITE,READ)we make the calculation to

find a solution (SAL) to the problem.

In Pascal programming we can calculate with the upper and down comma followed by

the equal sign .

So we say to find the salary (SAL)we must calculate (with math priority)and for start

multiply the daily payment(PAYDAY)with the working days(WORKDAYS)then

multiply the overhours(OVERTIME)with the sum of extra working days(OVERMONTH)

make an addition with these two multiplications and subtract the TAX which is 40 Euro.

At the two last line we make the OUTPUT with WRITE and we End the body of the program

with the keyword END followed by a dot.

We compile it and RUN IT.

Hope for enjoy it

Odysseas

 

 

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
19 Comments
  1. There’s a Year and A half since I made PASCAL LOGISTICS PROGRAMMING Software ! The target WAS NOT EASY but I thank God because the target is accomplished !I was Technical Manager in Rex Shipping (a company with huge profits for the Greek Goverment)and sometimes Math Complexity can be a very anxious Job even for the best professionals Worldwide ..
    Right now Iam writing much more dufficult Programs in comparison with LOGISTICS and not only Economics .
    In Greece we have a large problem with fugitives and things like copyright and Access Rights to sensitive data, can be a real pain in the ass ..
    Thanks All of You Who Support Me from the Day One
    With Respect
    Jimmy Dapontes

  2. Pascal was my Best Programming language. So cool and interesting.

  3. thank you. very helpfull.

  4. ΠΟΛΥ ΚΑΛΟ ΠΑΡΑΔΕΙΓΜΑ.

  5. Nice tutorial, found it helpful

Page 2 of 2«12
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel