Question: (Java Programming): Create a PriceException class that extends Exception, with a constructor that accepts a String with a product's description and price. Next, make a
(Java Programming): Create a PriceException class that extends Exception, with a constructor that accepts a String with a product's description and price.
Next, make a Product class with fields for description and price, and a constructor that accepts both. In that constructor, throw a PriceException if the price is a negative number or is more than $9,999.99.
Write an application named DemoProduct that creates an array of three Products. Prompt the user for the description and price of each; if a PriceException occurs, output an error message. After collecting input, output all of the products in the array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
