C# .NET Application Book Publication and Display as per requirement

profilenihil.khagram
 (Not rated)
 (Not rated)
Chat

 

1. De ne the Publication class and write C# properties for each attribute. (Note: you may use auto-

implemented properties and are not required to implement a constructor, but you can if you wish)

2. Override the ToString() method in the Publication class to return a formatted string containing the

title, author, and price. For example:

Tracker by C. J. Cherryh $14.90

3. De ne a PrintDetails() method in the Publication class to print the remaining lines common to all

publications.

4. De ne the Book class as inheriting from Publication and write C# properties for each additional

attribute. Override the PrintDetails() method to also the lines speci c to a Book. Because the

important details of a book are the same as those for a publication, you should not need to override

the ToString() method.

5. De ne the AudioBook class as inheriting from Publication and write C# properties for each addi-

tional attribute. Override the PrintDetails() method to also print the lines speci c to an AudioBook.

Override the ToString() method to include the narrator.

6. Create a single list of Publications, initialised to contain the example data.

7. Loop through each item, printing the string representation of the item followed by its details.

Extension

Note: For MTS9114 students, standard and extension sections are each worth 50% of the marks for the

assignment.

8. If you haven't already. Modify the implementation of the Publication class so that the publication

date property is of type DateTime. Ensure that everything still works.

9. Every publication has a publication date. In most cases, the date is in the past, and the publication

was \Published" on that date. However, if the date is in the future, the publication has not yet been

published, and will become \Available" on that date. Change the PrintDetails() implementation so

that the publication date is printed di erently depending on whether the publication date is after

today or not. You should be able to achieve this by using methods and formatting options available

to the DateTime class

Normally, the format should be:

Published: 7/04/2015

but if the publication date is in the future, the format should be:

Available: Tuesday, 27 October 2015

3

10. Every book has an ISBN. Because the old ISBN format only used 10 digits, they are often printed

with a hyphen between the rst 3 digits and the remaining 10 digits. Modify the PrintDetails()

method to output the ISBN in this format:

ISBN-13: 978-0756410759

11. You can determine whether and ISBN is valid by calculating a checksum. For 13-digit ISBNs, this is

done by calculating the sum of the 2nd, 4th, 6th, 8th, 10th, and 12th, multiplied by 3 and adding the

sum of the remaining 1st, 3rd, 5th, 7th, 9th, 11th, and 13th digits. If the resulting total is divisible

by 10, then the ISBN is valid. Write a method in the Book class to check an ISBN13. It should

return true if the ISBN13 is valid.

12. Modify the PrintDetails() method of the Book class to print (valid) or (invalid) after the ISBN as

appropriate. For example:

ISBN-13: 978-0756409098 (valid)

13. Write a comment explaining whether you think it is better to store an ISBN as a long or a string.

Explain your answer.

14. Write a method in the Program class which returns a list of all Publications with an invalid ISBN.

Write code in main to test this method.

Submission instructions

You must submit your C# code via the eLearning site (Moodle assignment dropbox) once you have

been successfully marked in the laboratory. It is this submission that is the ocial record that you have

completed the assessment.

1. Assignments are marked in your assigned lab, you may be required to answer questions, or modify

your code.

 

  • 11 years ago
C#.NET Book Application
NOT RATED

Purchase the answer to view it

blurred-text
  • attachment
    assgn2.zip