5.(3 points) The following defines class Product,with a no-argument constructor that sets the products name to an toProductS

5.(3 points) The following defines class Product,with a no-argument constructor that sets the product’s name to an toProductString method that returns a String containing the product’s name and its price: empty String and the price to 0.00, and a public class Product private String name; private double price; public void Product () { “” name = price = 0.00; } // end Product constructor public toString() { return String.format (“%s costs %.2d”, }// end method toString } // end class Product name, price);



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *