subject

Write the program BookExceptionDemo for the Peterman Publishing Company. Create a BookException class that is instantiated when a Book’s 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: For Goodnight Moon, ratio is invalid. ...Price is $12.99 for 25 pages. Next, 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. Finally, using the Book class, create 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 of 10 cents per page. At the end of the program, display all the entered, and possibly corrected, records

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, mayaparness
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
Answers: 2
image
Computers and Technology, 23.06.2019 15:00, hunteryolanda82
Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? explain the basis for your answer. with a significant economic recovery, what do you think will happen to future enrollments in graduating engineering programs?
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, alangonsales6232
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
image
Computers and Technology, 24.06.2019 13:30, nina288
What process should be followed while giving a reference? sam has given a reference of his previous manager in his resume. sam should him in advance that the potential employers will him.
Answers: 1
You know the right answer?
Write the program BookExceptionDemo for the Peterman Publishing Company. Create a BookException clas...

Questions in other subjects:

Konu
History, 07.12.2020 15:00
Konu
History, 07.12.2020 15:00
Konu
English, 07.12.2020 15:00