

/**
 * Title:        Exercise Solutions
 * Description:  Solutions to the exercises for Introduciton to Java Programming with JBuilder 4
 * Copyright:    Copyright (c) 2000
 * Company:      Armstrong Atlantic State University
 * @author Y. Daniel Liang
 * @version 1.0
 */

public class Exercise4_12
{
  public static void main(String[] args)
  {
    System.out.println(format(10.3422345, 3));
    System.out.println(format(-0.343434, 4));
  }

  public static double format(double number, int position)
  {
    return (int)(number*Math.pow(10, position-1))/
      Math.pow(10, position-1);
  }
}