Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needed in C#, How to print the lists source code needed Concept Summary: 1. Object Oriented programming concepts 2. Abstract classes 3. Polymorphism Objective: In

Needed in C#, How to print the lists source code needed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Concept Summary: 1. Object Oriented programming concepts 2. Abstract classes 3. Polymorphism Objective: In this Lab you will need to create three classes and a driver program. The first class, the parent, should be an abstract class called Item. The other two classes, the children, should inherit from the parent class and be called Book and Periodicals. Finally, create a test class called myCollection Using IntelliJ/Visual Studio create a UML diagram for this Lab. Item abstract class Create an abstract class called Item. It must have: title - A private attribute of type string. A getter/setter for title A constructor that takes no arguments and sets title to empty string A constructor which takes a title and sets the title attribute getListing is an abstract method that returns a string and is implemented in classes Book and Periodicals An override of toStringToString which returns the title Book child class Create a Book class which inherits from Item. It must have: isbn_number - A private attribute which holds an ISBN number (13 digits) to identify the book author - A private attribute which holds the authors name (string) getters/setters for the attributes in this class. A constructor which takes no arguments An overloaded constructor which sets all the attributes in the Book class as well as the Item class. A concrete version of the getListing method which should return a string that contains the following: Book Name - Title Author - Author ISBN # - ISBN number Periodical child class Create a Periodical class which inherits from Item. It must have: issueNum - A private attribute which holds the issue number (e.g. 103) getter/setter for issueNum A constructor which takes no arguments An overloaded constructor which sets all the attributes in the Periodical class as well as the Item class. A concrete version of the getListing method which should return a string that contains the following: Periodical Title - Title Issue # - Issue number myCollection Driver Program Write the driver program which will prompt the user exactly 5 times to add Books and Periodicals to an array The array should be of type Item since it can hold either Books or Periodicals. This is polymorphism! Ask the user to "Please enter B for Book or P for Periodical" If they choose Book, prompt for Title, Author and ISBN number. Store the results in the next cell of the array. If they choose Periodical, prompt for Title and IssueNumber. Store the result in the next cell of the array. Once the user has entered 5 items which could be any combination of Books and Periodicals, show the user their collection See sample output below. Sample Output: Please enter B for Book or P for Periodical B P Please enter the name of the Book Lord of the Rings Please enter the author of the Book Tolkien Please enter the ISBN of the Book 34 Please enter B for Book or P for Periodical Please enter the name of Periodical Times Please enter the issue number 1234 Please enter B for Book or P for Periodical B Please enter the name of the Book War and Peace I Please enter the author of the Book Tolstoy Please enter the ISBN of the Book 4567 B Please enter B for Book or P for Periodical Please enter the name of the Book Alice in Wonderland Please enter the author of the Book Lewis Carroll Please enter the ISBN of the Book 7890 Please enter B for Book or P for Periodical Please enter the name of Periodical New Yorker Please enter the issue number P 45 Your Items: Book Name - Lord of the Rings Author - Tolkien ISBN# - 34 Periodical Title - Times Issue # - 1234 Book Name - War and Peace Author - Tolstoy ISBN# - 4567 Book Name - Alice in Wonderland Author - Lewis Carroll ISBN# - 7890 Periodical Title - New Yorker Issue # - 45

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

What has been the evolution of HRM?

Answered: 1 week ago

Question

2 What are the implications for logistics strategy?

Answered: 1 week ago