public class TaxService { public double calcTaxRate(double subtotal, double total) { double rate = (total - subtotal)/ subtotal; return rate; } public double calcSubTotal(double total, double taxpercent) { double subtotal = total/(1 + taxpercent); return subtotal; } public double calcTotal(double subtotal, double taxpercent) { double total = subtotal * (1 + taxpercent); return total; } }