# Please i need the code to this Question....help with the coding

Write a java program that can compute the netpay of a staff at an organization using the following pieces of information:
-Netpay=Basic Salary + House allowance + Transport allowance + medical allowance - Pension - tax.
where house allowance=7% of the basic salary, Transport allowance=5% of the basic salary, Medical=10% of the basic salary, Pension=11% of the basic salary and Tax=9% of the basic salary.

Welcome to the forums, @femi490.

That sounds like an assignment question, and nobody here is going to do it for you.

If you show the code you have so far, and explain where you are stuck and what help you need, then I expect youâ€™ll find someone willing to assist.

2 Likes

it is a question from a past question but we are yet to be taught the coding just the code format, wanna start practicing so please help.

And how is getting someone to do it for you going to help you practice?

Make a start and let us know where you get stuck.

2 Likes

ok! will try my bestâ€¦am happy to be here.

2 Likes

So to my understandingâ€¦Netpay=basic salary +House Allowance + Transport +Medical- pension-tax.
but i will have to compute for the %'s first

like Housing allowance = Basic salary * 7/100.
and like that for each befor effecting the netpay formula
am i correct sirs??

Yes, youâ€™ll need to calculate house allowance before you can add it into the net pay. Likewise the other figures.

Thanks alot

``````//A java program to Compute Netpay.
import java.util.*;
import java.io.*;
public class Netpay
{
public static void main(String arg[])
{
Double NP,BS,HA,TA,MA,P,T;
Scanner P=new scanner(System.in);
BS=P.nextDouble();
HA=0.07*BS;
TA=0.05*BS;
MA=0.1*BS;
P=0.11*BS;
T=0.09*BS;
NP=(BS+HA+TA+MA)-(P+T);
System.out.printin(NP)
}
}
``````

is this correct plsâ€¦for my above question.

Does it give the correct answer?

i havenâ€™t been taught to that level sir

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.