Jubecron Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Jubecron Forum

The JUBECRON forum - Jamaican Chat, Dating, Games, Anime, and just meeting people.
 
HomePortalSearchLatest imagesRegisterLog in

 

 Introduction to If Statements in Prolog

Go down 
AuthorMessage
Beezle
Elite Member
Elite Member
Beezle


Female
Number of posts : 547
Age : 34
Mood : Introduction to If Statements in Prolog Breezy
Points : 253
Registration date : 2008-03-02

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
HP:
Introduction to If Statements in Prolog Left_bar_bleue50/50Introduction to If Statements in Prolog Empty_bar_bleue  (50/50)

Introduction to If Statements in Prolog Empty
PostSubject: Introduction to If Statements in Prolog   Introduction to If Statements in Prolog Icon_minitimeTue Oct 19, 2010 7:47 pm

Question:
Calculate net salary using gross salary and tax.


% Author: Claudia-Ann Gray 0702011
% Date: 10/5/2010

net_sal:-write('Enter salary: '), nl, read(Sal), calc_tax(Sal, Tax), calc_net(Sal, Tax).

calc_tax(Sal, Tax):-Sal > 1, Sal < 5001 -> Tax is Sal * 0.15;
Sal > 5000, Sal < 10001 -> Tax is Sal * 0.18;
Sal > 10000, Sal < 20001 -> Tax is Sal * 0.20;
Sal > 20000 -> Tax is Sal * 0.25;
Tax is 0.

calc_net(Sal, Tax):-Net is Sal - Tax, nl, write('Net salary is '), write(Net).
Back to top Go down
 
Introduction to If Statements in Prolog
Back to top 
Page 1 of 1
 Similar topics
-
» Introduction to Function Call and Parameter Passing in Prolog
» Prolog Lab 2
» prolog lab 3
» Prolog Lab 1
» Prolog Lab 5

Permissions in this forum:You cannot reply to topics in this forum
Jubecron Forum :: School :: Schools (General)-
Jump to: