package round;

public class Roundness {
	
	/**
	 * roundTwoDecimal - this method round the number to 2 decimal places
	 * @param number - number which will be rounded
	 * @return double rounded number
	 */	
	public static double roundTwoDecimal(double number){
		number=number*1000;
		number=number-(number%1);
		number=number/10;
		double remainder=(number%1);
		number=number-remainder;
		if ((remainder*10)>=5)number++;
		number=number/100;
		
		return number;
	}
	
	/**
	 * roundFourDecimal - this method round the number to 4 decimal places
	 * @param number - number which will be rounded
	 * @return double rounded number
	 */	
	public static double roundFourDecimal(double number){
		number=number*100000;
		number=number-(number%1);
		number=number/10;
		double remainder=(number%1);
		number=number-remainder;
		if ((remainder*10)>=5)number++;
		number=number/10000;
		
		return number;
	}	

}
