please help me with java we have to design an application that will calculate gross salary where basic salary is input through keyboard DA is 65% of basic salary. HRA is 45% of basic salary and TA is $10. @experimentX
?? DBMS or what??
we have to design this program in java
some stuff like float bs, da, hra, ta, gs;
do you have an alogrithm??
float bs, da, hra, ta, gs; bs= float.parsefloat(bs.setText("")); da= float.parsefloat(bs.getText()); da= bs* 65/100; da.setText(""+bs*65/100);
you are taking input from a form??
seems all right ...
but i'm not getting why we are taking float?
probably because you need to calculate in decimals
but can we use double instead of float?
both represents fractional no.
sure ... if you want more precise.
but ... i think that's unnecessary da= bs* 65/100; da.setText(""+bs*65/100); either do da= bs* 65/100; da.setText(""+da); or da.setText(""+bs* 65/100); is da your input field?
no the input field is basic salary bs
oh ... just do this da.setText(""+bs* 65/100); It's been a quite a lot since i programmed java.
to be clear on your basics you can take a visit to thenewboston.org
@vdidit : but i'm not getting why we are taking float? Ans: Double are generally used when one need the precision they provide. Also they take more memory and are slow in calculation. Where as Float are faster. For performance critical applications Integers are used in decimal calculation as they have least overhead in comparison to float and double . Float are faster than double for calculations. Read this article, where author compares performance of double against float in matrix multiplication for a nural network application. http://www.heatonresearch.com/content/choosing-between-java%E2%80%99s-float-and-double
Join our real-time social learning platform and learn together with your friends!