C# Programming BookExceptionDemo - 75864

Request Posted by


Rating : No Rating
Earned: $0
Request Detail
Price: $12
  • From: Computer Science, C Programming
  • Due on: Sun 30 Nov, 2014 (07:22pm)
  • Asked on: Tue 25 Nov, 2014
  • Due date has passed, but you can still Post Solution.

a. Create a program named BookExceptionDemo   for the Peterman Publishing Company. The company has decided that no published book should cost more than 10 cents per page. Create a   BookException   class whose constructor re-quires three arguments: a string Book title, a double price, and an int 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 10cents per page. Create a program that creates at least four Book objects - somewhere the ratio is acceptable and others where it is not. Catch any thrown exceptions and display the BookException Message.

b. Using the   Book   class created in Exercise 5a, 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 Book’s price to the maximum 10 cents per page. At the end of the program, display all the entered, and possibly corrected, records.

1 Solution for C# Programming BookExceptionDemo
Title Price Category solution By purchased  
C# Exercise5 A and B BookExceptionDemo
$12.00 Computer Science, Object Oriented Programming jordanblink 1 time(s)
Please Login or Register to Submit the Solution for the Request