Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C# program named BookExceptionDemo for the Peterman Publishing Company. Create a BookException class that is instantiated when a Books price exceeds 10 cents

Create a C# program named BookExceptionDemo for the Peterman Publishing Company. Create a BookException class that is instantiated when a Books price exceeds 10 cents per page and whose constructor requires three arguments for title, price, and number of pages. Create an error message that is passed to the Exception class constructor for the Message property when a Book does not meet the price-to-pages ratio. For example, an error message might be: For Goodnight Moon, ratio is invalid. Price is $12.99 for 25 pages. Create a Book class that contains fields for title, author, price, and number of pages. Include properties for each field. Throw a BookException if a client program tries to construct a Book object for which the price is more than 10 cents per page. Create a program that creates at least four Book objectssome where the ratio is acceptable, and others where it is not. Catch any thrown exceptions, and display the BookException Message. Using the Book class, write an application named BookExceptionDemo2 that creates an array of five Books. Prompt the user for values for each Book. To handle any exceptions that are thrown because of improper or invalid data entered by the user, set the Books price to the maximum of 10 cents per page. At the end of the program, display all the entered, and possibly corrected, records.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions