// *************************************************************
// Name:         Mohamed Aboutabl
// Date:         9/15/2004
// Assignment:   Programming Assignment #1 RodConverter.java
//
// *************************************************************
// References & Acknowledgements: I received no outside help
//
// *************************************************************
// Name of the class:	RodConverter
// Purpose of the class:Convert rods to yards and miles
// *************************************************************

import java.text.DecimalFormat ;
import cs1.Keyboard ;

public class RodConverter
{
	/**----------------------------------------------------------
	// Read in a distance in rods and display the equivalent 
	// yards and miles
	// --------------------------------------------------------*/
	public static void main( String[] args)
	{
		// Variables Declarations
		double rods,		// number of rods to convert
				yards ,		// equivalent yards
				miles ;		// equivalent miles

		final double YARDS_PER_ROD = 5.5 ,		// Conversion constants
		             YARDS_PER_MILE = 1760.0 ;
		
		DecimalFormat twoDecimals;
		twoDecimals = new DecimalFormat("0.00") ;
		
		// Print the header
		System.out.println("\n\t\t\tRod Converter\n");
		
		// Get the number of rods to convert then echo the values
		System.out.print("Enter the number of rods to convert: ");
		rods = Keyboard.readDouble() ;
		System.out.println("\nNumber of rods:\t" + twoDecimals.format(rods) );
		
		// Convert to yards and miles
		yards = rods * YARDS_PER_ROD ;
		miles = yards / YARDS_PER_MILE ;
		
		
		// Format and display the results on the screen
		
		System.out.println("\nNumber of yards:\t" + twoDecimals.format(yards) );
		System.out.println("Number of miles:\t" + twoDecimals.format(miles) );
		
		// Dsiplay the exit message 
		System.out.println("\n\t\tExiting program Rod Converter");
			
	}
}