//Product.java public class Product { private String name; private double price; public Product(String name, double price) { this.name = name; this.price = price; } public String getName() { return name; } public double getPrice() { return price; } public void productPrinter(){ System.out.println(name+": "+(price-5)); } public static void main(String[] args) { Product p = new Product("Toaster",29.95); p.productPrinter(); } }
Get Answers For Free
Most questions answered within 1 hours.