// ********************************************************
// Name:         Mohamed Aboutabl
// Date:         9/16/2004
// Assignment:   Lab 8 - Part 2 PIPlay.java
//
// *************************************************************
// References & Acknowledgements: I received no outside help
//
// ********************************************************
// PIPlay.java
//
// Play with the Math class and PI
//
// ********************************************************

// import statement goes here

import java.text.NumberFormat ;
import java.text.DecimalFormat ;

public class PIPlay
{
    // ---------------------------------------------------
    //  main 
   //  --------------------------------------------------

    public static void main (String[] args)
    {
	 	double piDbl ;		// the double value of PI
		float  piFlt ;		// the float value of PI
		int    piInt ;		// the integer valaue of PI
		NumberFormat perc;	// A % formatter
		DecimalFormat f1, f2, f3, f4, f5, f6;
		
		piDbl = Math.PI ;
		piFlt = (float) piDbl ;
		piInt = (int)   piDbl ;
		
		System.out.println("The double value of PI is " + piDbl );
		System.out.println("The float  value of PI is " + piFlt );
		System.out.println("The int    value of PI is " + piInt );
		
		perc = NumberFormat.getPercentInstance() ;
		System.out.println("The % value of PI is " + perc.format(piDbl) );
		
		f1 = new DecimalFormat("0");
		System.out.println("\n1) The value of PI to ONE digit is " + f1.format(piDbl) );
		
		f2 = new DecimalFormat("0.#####");
		System.out.println("2) The value of PI to 5 decimal places is " + f2.format(piDbl) );
		
		f3 = new DecimalFormat("0.####");
		System.out.println("3) The value of PI to 4 decimal places is " + f3.format(piDbl) );
		
		f4 = new DecimalFormat("00000.######");
		System.out.println("4) The value of PI to 5 decimal places and 5 whole digits is " 
									+ f4.format(piDbl) );
		
		f5 = new DecimalFormat("VALUE: 0.#####");
		System.out.println("5) The value of PI with words in format pattern " + f5.format(piDbl) );
		
		f6 = new DecimalFormat("$0.#####");
		System.out.println("6) The Currency value of PI to 5 decimal places is " + f6.format(piDbl) );


	 }
}

