techhipbettruvabetnorabahisbahis forumutaraftarium24eduedusedueduseduseduedusedueduedu Java Program to Calculate PF in 2 Ways | Java Programs
Latest :

Java Program to Calculate PF in 2 Ways | Java Programs

Java Program to Calculate PF – in 2 ways. In this problem, we need to find the gross salary and providential fund for our given input values.

Gross salary is found by subtracting provident fund (pf) from cost-to-company.

For this, our required inputs are basic pay amount (basicpay), percentage of dearness allowance (da), percentage of house rental allowance (hra), percentage of travelling allowance (ta) and percentage of providential fund (pf). All these input values are either money or in percentage so can be fractional. So, we make use of type double.

To read all our inputs at runtime, we will be making use of Scanner class in Java. They are very useful for reading inputs of any primitive type like int, float, long, double, char, etc at runtime. For making use of this, we will require to first create an object for this class. Since all our inputs are of double format, for all of them we invoke the nextDouble() method of Scanner class to read input at runtime as follows:

Scanner s= new Scanner(System.in);

System.out.println(“Enter BASIC PAY AMOUNT”);

basicpay=s.nextDouble();

System.out.println(“Enter the DEARNESS ALLOWANCE %:”);

da=s.nextDouble();

System.out.println(“Enter the HOUSE RENTAL ALLOWANCE %:”);

hra=s.nextDouble();

System.out.println(“Enter the TRAVELLING ALLOWANCE %:”);

ta=s.nextDouble();

System.out.println(“Enter the PROVIDENTAIL FUND %:”);

pf=s.nextDouble();

After getting all our necessary inputs, we will need to find the gross salary. To determine the gross salary the formula to be used is as below:

grosssalary=basicpay*(100+da+hra+ta-pf)*0.01;

or can also be written as,

grosssalary=basicpay*(100+da+hra+ta-pf)/100;

Just as the definition of gross salary states, we subtract the providential funds from our cost to company.

To find the providential fund is very easy. We only require the basicpay and the percentage of providential fund. The amount for providential fund is calculated as follows:

amount for providential fund= basicpay*pf*0.01

(or)

amount for providential fund= basicpay*pf/100

The final outputs can be displayed on the console screen by making use of System.out.println() method for displaying in the new line every time.

System.out.println(“Gross salary”+ grosssalary);

System.out.println(“PF amount is:”+ basicpay*pf*0.01);

 

Output:

 

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedueduseduedueduseduseduedus
x

Check Also

Java Program To Reverse An Array | Programs

Java program to reverse an array – We will discuss the various methods to reverse ...

grandpashabetgrandpashabetgrandpashabethttps://mobilebarhawaii.com/ballettea tropazcasibom girişcasibomhacklinkgrandpashabetbets10onwinonwin girişgrandpashabetholiganbetatakoy escortatakoy escortsisli escortjojobetCasibomtürk pornomavibet girişcratosroyalbetdeneme bonusu veren sitelergrandpashabetonwinligobetgonabetJojobetsahabethttps://www.escortbayanlariz.net/betwoonsahabetcasibomcasibom girişEskişehir escortjojobetbakırköy escortdeneme bonusu veren sitelerhalkali escortgrandpashabet girişholiganbet güncel girişankara escort bayancasino siteleriultrabetgrandpashabet girişholiganbetonwinholiganbetgrandpashabetesenyurt anal escortPadişahbetnakitbahiscasibom girişgrandpashabetİstanbul Escorthttps://www.gvscolombia.com/betebetdeneme bonusu veren sitelerJojobet GirişstarzbetsavoybettingsavoybettingjojobetfixbetBetturkey girişcasibom güncel girişkucukcekmece escortholiganbetimajbetkingroyalmadridbetmatbetmavibetmeritbetmeritkingonwinotobetmeritbetimajbetcasibomsekabetbetvolebetordercasinolevantArtemisbetmadridbetmavibetmeritking girişotobetjojobetholiganbetholiganbet girişonwincasibom girişcasibom girişsahabet girişmadridbetbetturkey girişmarsbahis giriş güncelsahabet güncel giriştipobetistanbul escortscanlı bahisstarzbetultrabetjojobetenbetvbettrromabetcasibom girişcasibomcasibom güncel girişjojobetmegabahisjojobet girişmarsbahiszbahisperabetbakırköy escortdeneme bonusu veren sitelerbetebet güncel girişdumanbetsightcarebilyoneronwinonwinsahabetbets10,bets10 giriş,bets10 güncel giriştipobetmarsbahis,marsbahis güncel giriş , marsbahis giriş,marsbahis adresmarsbahis,marsbahis güncel giriş , marsbahis giriş,marsbahis adressekabetpradabettarafbetmilanobetmilanobetpusulabettempobetpusulabettempobetpusulabetjojobetbets10madridbetBostancı escort Bağcılar escortmatbetjojobet,jojobet girişsekabet girişjojobet,jojobet girişjojobetizmir escortcasibomtipobetjasminbetİstanbul Escortbahis sitelericasibomjojobet girişJojobet Girişankara escortzbahiszbahis girişzbahis güncel girişholiganbetcasibomsonbahisdeneme bonusu veren siteler 2025vaycasinocasinomaxizbahisotobet girişimajbetcasibomvaycasinojojobetbetturkeymarsbahis girişmatbet girişmarsbahisbetturkeybetexperdeneme bonusu veren sitelermariobetwinxbetbetexperbetofficegonebetgrandpashabetgrandpashabet güncelpusulabetpusulabetcasibom girişonwin,onwin giriş,onwin güncel giriş,onwin giriş adresitipobetbetebetmarsbahisultrabetholiganbetjojobetfixbetkulisbetnakitbahispinbahisrestbettipobettrendbetultrabetjojobetholiganbetotobetbetexperpusulabetasyabahisparibahiskulisbettipobetHoliganbet girişfixbetvaycasinojojobet,jojobet girişonwinhttps://sahipleniyorum.com/jojobetjojobet girişultrabetmatbetcasibomcasibom girişmaltepe escortextrabet girişmecidiyeköy escortsekabet girişjojobettipobetbetturkeygonabettipobetcasibom girişmavibetmavibet girişmaltcasinomaltcasino girişmavibet güncelJojobet girişMAVİBETİMAJBETextrabetzbahismarsbahisbahis forumcasibom giriştakipçi hilesivaycasinocashback girişjojobetgonebetjojobetjojobetgüncel girişcasinoroyalcasibom