I wasnt the one who posted the question, but I am workin on a program that has a sim problem. Its a calculater that that works out the ultimate return on a purchase. I am writing it for an MMORPG I play.
1. Regrettably, for negative numbers williamhemsworth's solution does not work (moreover, gives wrong result - for example, it yields 0 for -0.9 but nearest integer value for -0.9 is -1). Right solution:
2. In this context a rounding to the nearest integer is not the same thing as a rounding to the nearest int type value. For example, on 32-bit CPU max int is 2147483647 (INT_MAX macros from limit.h). So you can't round 3333333333.3 to int 3333333333 (no such int value) - but you can round it to 3333333333.0. Of course, if you want to round to int, you may use the same method as in round function defined above (no need in floor library call in that case).
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);