public class Product { // Class data members protected String name; protected double price; // Constructor public Product(String n, double p){ //to do: assign parameter n to name //to do: assign parameter p to price name = n; price = p; } // Creates the string that represents this object when displayed public String toString() { String output ="nothing"; // to do concatenate the name and prince into a String. Example Apple $1.69 output = name + " $" + price; return output; } // method that makes a computation with the class data and returns a value public double priceWithTax(){ // to do: return price * 1.07 return price * 1.07; } // calculate cost of product. Simple case cost = price public double cost(){ return price; } // getter and setter methods for class data public String getName(){ return name; } public void setName(String n){ name = n; } public double getPrice(){ return price; } public void setPrice(double p){ price = p; } }