Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)
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:

 

x

Check Also

HCF Of Two & N Numbers Java Program | 3 Ways

Java program to find HCF of two numbers – The below given Java programs explains ...

atakoy escortatakoy escortbakırköy escortşişli escortbağcılar escortsightcaredeneme bonusu veren sitelerromabetdeneme bonusu veren sitelerdeneme bonusu veren sitelerDeneme Bonusu Veren SitelerDeneme Bonusu Veren SitelerDeneme Bonusu Veren SitelerDeneme Bonusu Veren Sitelersekabetdeneme bonusu veren sitelergrandpashabetgrandpashabetGrandpashabetdeneme bonusu veren sitelerdeneme bonusu veren sitelercasibomcasibom güncel girişdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelercasinofastbetwoonroyalbetdeneme bonusugrandpashabetdeneme bonusu veren sitelermarsbahis girişvaycasino girişmeritkingdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerromabetistanbul escortgrandpashabetgrandpashabetgrandpashabetgrandpashabetelitcasinocasibomjojobetcasibomcasibom girişcasibom girişcasibomgrandpashabetcasibom girişcasibomcasibom girişcasibomcasibom güncel girişcasibomcasibom girişcasibomcasibom girişcasibom girişcasibom güncel girişgrandpashabetgrandpashabet girişgrandpashabetgrandpashabet girişbetgray güncel girişvdcasinograndpashabetgrandpashabetgrandpashabetgrandpashabetgrandpashabetGrandpashabetzbahiscasibom girişcasibom girişcasibom girişdeneme bonusubetcio girişbetkomdeneme bonusu veren sitelerRokubetjojobetDeneme Bonusu Veren SitelerjojobetcasibompadişahbetjojobetjcknepadişahbetBetsatVdcasinorotabetsekabetHoliganbetzbahiszbahisotobetnakitbahiskingroyalkingroyalmadridbetmadridbettarafbet토토사이트avrupabetmarsbahisLefkoşa İngilizce KursuportobettimebettimebetdizipalRokubet girişcasibombetparkbetparkcasibomcasibomcasibommeybetbetpuancasibom girişzbahiscasibommatbet girişvdcasino giriştempobetpusulabet girişgrandpashabet girişmeritking girişgrandpashabet girişmeritking girişbahiscom girişonwinmatadorbetjojobetsahabetmatadorbetonwinsahabetsahabet girişjojobet girişsahabetmatadorbet girişsahabetsahabetonwin güncel girişonwinonwinonwincasibomcasibomcasibomcasibom girişcasibomcasibom girişholiganbetpusulabetbetboobetparktempobetextrabetmegabahisbetpuansahabet güncel girişonwinmatadorbetholiganbetsahabetkralbet girişkralbetsahabetsahabet güncel girişsahabet güncel girişpusulabetmatadorbetbets10bets10 girişpusulabet girişonwin güncel girişsahabet güncel girişpusulabet girişbetboo girişpusulabetslotbarmatadorbetbetboomatbet orijinalbetparktempobetsahabet güncel girişextrabet güncel girişCasibombetpuanslotbarbahiscombetpuangrandpashabet girişcasibomcasibomcasinoper girişcasinoperPusulabetcasibom girişdedebetromabettambetdinamobetsahabetbetwoonfenerbahçebetofficejojobetgrandpashabetgrandpashabetgrandpashabetlunabetgrandpashabetmarsbahis