in c # i need to  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. my errors are Test Case Incomplete Complete program walkthrough, test 1 Input Book1 Author1 10.99 200 Book2 Author2 19.99 100 Book3 Author2 25.00 600 Book4 Author3 5.00 20 Book5 Author4 8.00 120 Output Enter information for book #1: Title: Author: Price: Number of pages:  Unhandled Exception: System.DivideByZeroException: Value was either too large or too small for a Decimal.   at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0    at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0  [ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Value was either too large or too small for a Decimal.   at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0    at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0  Results For Book2, ratio is invalid....Price is $19.99 for 100 pages.For Book4, ratio is invalid....Price is $5.00 for 20 pages.Book1 by Author1 Price $10.99 200 pages.Book2 by Author2 Price $10.00 100 pages.Book3 by Author2 Price $25.00 600 pages.Book4 by Author3 Price $2.00 20 pages.Book5 by Author4 Price $8.00 120 pages. Test Case Incomplete Complete program walkthrough, test 2 Input Where The Crawdads Sing Delia Owens 9.59 384 American Dirt Jeanine Cummins 16.79 400 Golden in Death J.D. Robb 18.41 400 The Silent Patient Alex Michaelides 13.49 336 The Dutch House Ann Patchett 15.99 352 Output Enter information for book #1: Title: Author: Price: Number of pages:  Unhandled Exception: System.DivideByZeroException: Value was either too large or too small for a Decimal.   at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0    at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0  [ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Value was either too large or too small for a Decimal.   at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0    at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0    at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0  Results Where The Crawdads Sing by Delia Owens Price $9.59 384 pagesAmerican Dirt by Jeanine Cummins Price $16.79 400 pagesGolden in Death by J.D. Robb Price $18.41 400 pagesThe Silent Patient by Alex Michaelides Price $13.49 336 pagesThe Dutch House by Ann Patchett Price $15.99 352 pages and  Unit Test Incomplete BookException test Build Status Build Failed Build Output Compilation failed: 2 error(s), 1 warnings NtTestcae2af8d.cs(5,1): warning CS0105: The using directive for `System' appeared previously in this namespace NtTestcae2af8d.cs(10,45): error CS1729: The type `Book' does not contain a constructor that takes `4' arguments BookExceptionDemo.cs(23,14): (Location of the symbol related to previous error) NtTestcae2af8d.cs(15,36): error CS1729: The type `Book' does not contain a constructor that takes `4' arguments BookExceptionDemo.cs(23,14): (Location of the symbol related to previous error)

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 5E
icon
Related questions
Question

in c # i need to 

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.

my errors are

Test Case

Incomplete
Complete program walkthrough, test 1

Input
Book1
Author1
10.99
200
Book2
Author2
19.99
100
Book3
Author2
25.00
600
Book4
Author3
5.00
20
Book5
Author4
8.00
120
Output
Enter information for book #1:
Title: Author: Price: Number of pages: 

Unhandled Exception:
System.DivideByZeroException: Value was either too large or too small for a Decimal.
  at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0 
  at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Value was either too large or too small for a Decimal.
  at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0 
  at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0 

Results

For Book2, ratio is invalid....Price is $19.99 for 100 pages.For Book4, ratio is invalid....Price is $5.00 for 20 pages.Book1 by Author1 Price $10.99 200 pages.Book2 by Author2 Price $10.00 100 pages.Book3 by Author2 Price $25.00 600 pages.Book4 by Author3 Price $2.00 20 pages.Book5 by Author4 Price $8.00 120 pages.

Test Case

Incomplete
Complete program walkthrough, test 2

Input
Where The Crawdads Sing
Delia Owens
9.59
384
American Dirt
Jeanine Cummins
16.79
400
Golden in Death
J.D. Robb
18.41
400
The Silent Patient
Alex Michaelides
13.49
336
The Dutch House
Ann Patchett
15.99
352


Output
Enter information for book #1:
Title: Author: Price: Number of pages: 

Unhandled Exception:
System.DivideByZeroException: Value was either too large or too small for a Decimal.
  at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0 
  at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Value was either too large or too small for a Decimal.
  at System.Decimal+DecCalc.VarDecDiv (System.Decimal& d1, System.Decimal& d2) [0x0003e] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.Divide (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at System.Decimal.op_Division (System.Decimal d1, System.Decimal d2) [0x00000] in <7b90a8780ac4414295b539b19eea7eea>:0 
  at Book.set_Price (System.Decimal value) [0x0000c] in <671cd92b5601448b8eda3d3c75a5b366>:0 
  at BookExceptionDemo.Main () [0x000b7] in <671cd92b5601448b8eda3d3c75a5b366>:0 


Results
Where The Crawdads Sing by Delia Owens Price $9.59 384 pagesAmerican Dirt by Jeanine Cummins Price $16.79 400 pagesGolden in Death by J.D. Robb Price $18.41 400 pagesThe Silent Patient by Alex Michaelides Price $13.49 336 pagesThe Dutch House by Ann Patchett Price $15.99 352 pages

and 

Unit Test

Incomplete
BookException test

Build Status
Build Failed
Build Output
Compilation failed: 2 error(s), 1 warnings

NtTestcae2af8d.cs(5,1): warning CS0105: The using directive for `System' appeared previously in this namespace
NtTestcae2af8d.cs(10,45): error CS1729: The type `Book' does not contain a constructor that takes `4' arguments
BookExceptionDemo.cs(23,14): (Location of the symbol related to previous error)
NtTestcae2af8d.cs(15,36): error CS1729: The type `Book' does not contain a constructor that takes `4' arguments
BookExceptionDemo.cs(23,14): (Location of the symbol related to previous error)

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

im still getting two errors 

Test CaseIncomplete
Complete program walkthrough, test 1

Input
Book1
Author1
10.99
200
Book2
Author2
19.99
100
Book3
Author2
25.00
600
Book4
Author3
5.00
20
Book5
Author4
8.00
120
Output
Book1 by Author1 Price $10.99 200 pages.
Book2 by Author2 Price $19.99 100 pages.
Book3 by Author2 Price $25.00 600 pages.
Book4 by Author3 Price $5.00 20 pages.
Book5 by Author4 Price $8.00 120 pages.

Results
For Book2, ratio is invalid....Price is $19.99 for 100 pages.For Book4, ratio is invalid....Price is $5.00 for 20 pages.Book1 by Author1 Price $10.99 200 pages.Book2 by Author2 Price $10.00 100 pages.Book3 by Author2 Price $25.00 600 pages.Book4 by Author3 Price $2.00 20 pages.Book5 by Author4 Price $8.00 

and

Unit TestIncomplete
BookException test

Build Status
Build Failed
Build Output
Compilation failed: 4 error(s), 1 warnings

NtTestd3f6bac6.cs(5,1): warning CS0105: The using directive for `System' appeared previously in this namespace
NtTestd3f6bac6.cs(10,45): error CS1502: The best overloaded method match for `Book.Book(string, string, decimal, int)' has some invalid arguments
BookExceptionDemo.cs(12,12): (Location of the symbol related to previous error)
NtTestd3f6bac6.cs(10,74): error CS1503: Argument `#3' cannot convert `double' expression to type `decimal'
NtTestd3f6bac6.cs(15,36): error CS1502: The best overloaded method match for `Book.Book(string, string, decimal, int)' has some invalid arguments
BookExceptionDemo.cs(12,12): (Location of the symbol related to previous error)
NtTestd3f6bac6.cs(15,65): error CS1503: Argument `#3' cannot convert `double' expression to type `decimal'
Test Contents
[TestFixture]
public class TestBookException {
     [Test]
     public void FirstBookExceptionTest() {
         Assert.Throws<BookException>(() => new Book("Book1", "Author1", 5.00, 25));
    }

    [Test]
    public void SecondExceptionTest() {
         Assert.DoesNotThrow(() => new Book("Book2", "Author2", 5.00, 100));
    }
}

this one works though

Test CaseComplete
Complete program walkthrough, test 2

Input
Where The Crawdads Sing
Delia Owens
9.59
384
American Dirt
Jeanine Cummins
16.79
400
Golden in Death
J.D. Robb
18.41
400
The Silent Patient
Alex Michaelides
13.49
336
The Dutch House
Ann Patchett
15.99
352
Output
Where The Crawdads Sing by Delia Owens Price $9.59 384 pages.
American Dirt by Jeanine Cummins Price $16.79 400 pages.
Golden in Death by J.D. Robb Price $18.41 400 pages.
The Silent Patient by Alex Michaelides Price $13.49 336 pages.
The Dutch House by Ann Patchett Price $15.99 352 pages.

Results
Where The Crawdads Sing by Delia Owens Price $9.59 384 pagesAmerican Dirt by Jeanine Cummins Price $16.79 400 pagesGolden in Death by J.D. Robb Price $18.41 400 pagesThe Silent Patient by Alex Michaelides Price $13.49 336 pagesThe Dutch House by Ann Patchett Price $15.99 352 pages

my code is 

 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning