Part A: A Widget is a product. A Widget has an identifier, a… Part A: A Widget is a product. A Widget has an identifier, a productionDate
Part A: A Widget is a product. A Widget has an identifier, a… Part A: A Widget is a product. A Widget has an identifier, a productionDate and a Price. The productID of a Widget is the combination of the identifier and productionDate.Product p2 = new Widget(“82794-mach10q”, “12/7”, 89.99);P2 has an identifier of “82794-mach10q” and productionDate of “12/7”. Therefore it’s productID is: “82794-mach10q_12/7”.The Write the constructor for the Widget class.Part B: The canReplace() method determines if one product can be replaced by another. A Product can only be replaced when the identifier of the parameter productID is greater than the identifier of the calling object and when the price of the parameter product is greater than the price of the calling object.Thus p1.canReplace(p2) is false because the price of p2 is less than the price of p1.And p2.canReplace(w1) is false because the productID for w1 comes before the productID of p2.But w1.canReplace(p1) is true because the productID for p1 comes after the productID for w1 and the price w1 is less than the price of p1.Write the canReplace() method for the Product class below. Computer Science Engineering & Technology Java Programming Share QuestionEmailCopy link


