Getting started Community Training Tutorials Documentation APIs, AI & Tools
package com.me;
public class TaxCalculator {
public Double calculateTax(Double price) {
if (price == null) {
throw new NullPointerException("Must provide a value for price");
}
if (price < 0) {
throw new IllegalArgumentException("Price must be a non-negative value, but was: " + price);
}
return price * 0.21;
}
}



