This

class allows the user to enter a number and than rounds it off, correct to the nearest integer.
class rounds
{
void compute(double input)
{
double remainder=0; // INITIALIZATION AND DECLARATION OF
int whole=0,answer=0; // VARIABLES
whole = (int) input; // THIS LINE STORES THE INTEGER PART OF THE VALUE
// INTO A SEPERATE VARIABLE
remainder = input - whole; // REMAINDER IS THE VALUE AFTER THE DECIMAL
// POINT
if (remainder >= 0.5) // IF REMAINDER IS GREATER THAN 0.5
answer = whole + 1; // ADD 1 TO THE VALUE
else // OTHERWISE
answer = whole; // KEEP THE INTEGER PART AS IT IS
System.out.println("Rounded Off Number Is : "+ answer); // DISPLAY THE ANSWER

} // END OF FUNCTION

}