Quick Index
Code Explanation


Hello, my name is Lunch.

I implement the Taxable interface.

Note the "implements" keyword on the class header.

Read more about me below.

Three ivars for our simple class.
public class Lunch implements Taxable {
	private String description;
	private String model;
	private BigDecimal price;

	//etc (more code follows)

}
Simple String type for param
Internally more complex BigDecimal
	public Lunch(String aDescription, String price)  {
		this.description = aDescription;
		this.price = new BigDecimal(price);
	}
Because I (a Lunch) implement the Taxable idea, I must override "beforeTaxPrice" (Taxable requires me to).
	public BigDecimal beforeTaxPrice()  {
		return this.getPrice();
	}

Complete Source Code


Here is all my code.

Have Fun.

Thank you,
Lunch

package taxcalc.test;

import java.math.BigDecimal;

import taxcalc.model.Taxable;

public class Lunch implements Taxable {

	private String description;
	private String model;
	private BigDecimal price;

	public Lunch(String aDescription, String price) {
		this.description = aDescription;
		this.price = new BigDecimal(price);
	}

	public String getDescription() {
		return description;
	}

	public String getModel() {
		return model;
	}

	public BigDecimal getPrice() {
		return price;
	}

	@Override
	public BigDecimal beforeTaxPrice() {
		return this.getPrice();
	}

}