You really should explain your problem. What should it do, what it's actually doing, where you think the problem might be. If your compiler generated any error messages, what do they say, what line do they point to?
Yes, that works, but you're skating on thin ice (to get in an Olympics reference ;) )
20/100 by itself will not give you the 0.2 result you want. In your code, the operation is being coerced to floating point division by the fact that r is a float, and is an operand of the first operation carried out.
Why not just multiply by 0.2? Or at least ensure you get what you mean, and mean what you get, by using 20.0 / 100.0?
And as another aside, consider dropping the use of float type and always use doubles. Reserve floats for those cases where saving a lot of memory at the expense of some precision is a worthwhile tradeoff.
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...