/*
 *
 *	Tom DeDonno
 *	Discount1.java 

 	OOP Version of Discount.java
 	
        Has Four Methods: discountBeforeTax, discountAfterTax, read, print

	Calculates Total amount of Bill when discount of 15% is applied
	before and after tax.

	General Operator Precedence
	First ()
	Second *,/,%
	Third binary operators +,-
 *
 */


public class Discount3 {

	private final double TaxRate = 0.0775;
	private final double DiscountRate = 0.15;
	private double cost;

	private double discountBeforeTax( ) { return cost*DiscountRate; }
	
        private double discountAfterTax( ) {
                double totalCost = cost + cost*TaxRate;
                // lang.math has round off method
                int temp = (int)totalCost*100;
                totalCost = (double)temp/100.0;
                
		return totalCost*DiscountRate;
                }
                
        private void read( ) {
          
            System.out.println( "Enter Cost of Item: " );
            cost = SavitchIn.readLineDouble( );
          }
                
        private void print( ) {
                System.out.println( "Retail Cost of Item is " + cost );
		System.out.println( "I have a " + (DiscountRate*100) +
			"% Discount" );
		System.out.println( "Before Tax Discount Savings " +
			discountBeforeTax( ) );
		System.out.println( "After Tax Discount Savings " +
			discountAfterTax( ) );
              }
          

	public static void main( String[] args )  {

		Discount1 dis = new Discount1( );
                dis.read();
                dis.print();
		}
}

