Java Exceptions: Your parents gave you an emergency cash card that has 2 restrictions: it can't be used to purchase alcohol, and the purchase price must be less than $100. Write a program segment in...



Java Exceptions:


Your parents gave you an emergency cash card that has 2 restrictions:  it can't be used to purchase alcohol, and the purchase price must be less than $100.  Write a program segment in main() that will read 2 inputs from the user describing a purchase you are trying to make using the cash card:  the item purchased (eg runners) and the purchase price (eg 79.99).  Your code must check for the 2 restrictions mentioned above and generate exceptions if either one of them occurs (InvalidItemException or InvalidPurchasePriceException.  Assume that these have already been coded so you don't need to write them).  Your code must also deal with each exception by writing out an appropriate (specific) message stating what the problem is.  If there is no problem your code should generate a "Payment accepted" message.



Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here