Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Design a class called Product that has the following member variables: descri

ID: 3734857 • Letter: 1

Question

1) Design a class called Product that has the following member variables: description. A string that holds the description of the product. price. A double variable that holds the price of the product. The class should have the following member functions: A default constructor that assigns 0 to the price variable. A constructor that accepts the following values as arguments and assign them to the appropriate member variables: the description of the product and the price of the product setDescription: Stores a value in description .setPrice: Stores a value in price getDescription: Returns the value in description. .getPrice: Returns the value in price

Explanation / Answer

public class Product { private String description; private double price; public Product() { price = 0; } public Product(String description, double price) { this.description = description; this.price = price; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }