Writing cash register software is difficult Beyond the requi

Writing cash register software is difficult. Beyond the required accuracy and being able to scan and look up prices, cash registers must calculate the sales taxes owed. But every locality sets its own sales tax rates and every item needs to be placed in a specific category for correct taxation. With both the rates and classifications needing to change, this makes it a perfect place for a visitor. which creates the interface our visitors will be implementing. Then download the and the the NJaxiaitor class. Delaware does not have any sales tax, but New Jersey and Erie County do. The latter two classes should increase the value of sales taxes when each method is called. The comments in each of those classes specify the sales tax to charge

Solution

public class DelawareTaxVisitor implements TaxVisitor{
public void SalesTaxGrocery(double amount){}
public void SalesTaxPreparedFood(double amount){}
public void SalesTaxClothing(double amount){}
}
public class ErieCountyTaxVisitor implements TaxVisitor{
private double salesTaxes;
private static final double ERIE_CO_TAX = 0.0475;
private static final double NY_STATE_TAX = 0.04;
public void SalesTaxGrocery(double amount){}
public void SalesTaxPreparedFood(double amount){
salesTaxes += amount*0.0875;
}
public void SalesTaxClothing(double amount){
salesTaxes += amount*0.0475;
}
}
public class NJTaxTaxVisitor implements TaxVisitor{
private double salesTaxes;
private static final double STATE_TAX = 0.07;
public void SalesTaxGrocery(double amount){
salesTaxes += amount*0.07;
}
public void SalesTaxPreparedFood(double amount){
salesTaxes += amount*0.07;
}
public void SalesTaxClothing(double amount){
salesTaxes += amount*0.07;
}
}

 Writing cash register software is difficult. Beyond the required accuracy and being able to scan and look up prices, cash registers must calculate the sales ta

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site