FileDocCategorySizeDatePackage
IntFract.javaAPI DocExample520Sun Feb 08 21:33:58 GMT 2004None

IntFract

public class IntFract extends Object
Multiply a decimal fraction, not using floating point
author
Ian F. Darwin, http://www.darwinsys.com/
version
$Id: IntFract.java,v 1.5 2004/02/09 03:33:57 ian Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

		//+
		int a = 100;
		int b = a*5/7;
		System.out.println("5/7 of " + a + " is " + b);
		// Just for fun, do it again in floating point.
		final double FRACT = 0.7142857132857;
		int c = (int)(a*FRACT);
		System.out.println(FRACT + " of " + a + " is " + c);
		//-