Question

ALL DONE IN C# PLEASE Write a class, including all necessary methods and members, to represent...

ALL DONE IN C# PLEASE

Write a class, including all necessary methods and members, to represent a book. Include title, author, publisher, and isbn.

Write a child class of your book class, including all necessary methods and members, to represent a text book that has a category and an editor in addtion to the members of the book class.

Write driver class (with main) to test your book and text book classes.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Here a newConsole Application in C# is created using Visual Studio 2017 with name "BooksApplication".This application contains a class with name "Program.cs".Below are the details of this class.

Program.cs

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace BooksApplication
{
class Program //Class
{
//Main method
static void Main(string[] args)
{
//creating object of Textbook
Textbook textbook = new Textbook();
//asking user to enter author
Console.Write("Enter Title :");
//reading title
string title = Console.ReadLine();
//asking user to enter author
Console.Write("\n Enter Author :");
//reading author
string author = Console.ReadLine();
//asking user to enter publisher
Console.Write("\n Enter Publisher :");
//reading Publisher
string publisher = Console.ReadLine();
Console.Write("\nEnter ISBN :");
//reading ISBN
int ISBN = int.Parse(Console.ReadLine());
//asking user to enter category
Console.Write("\nEnter Category :");
//reading category
textbook.category = Console.ReadLine();
//asking user to enter edition
Console.Write("\n Enter Edition :");
//reading Edition
textbook.edition = int.Parse(Console.ReadLine());
//displaying book details
Console.WriteLine("====================BOOK DETAILS=========================");
//calling method to pass book details
textbook.getBook(title, author, publisher, ISBN);
//calling method to display category and edition
//calling method to display book
textbook.displayBook();
//to hold the screen
Console.ReadKey();
}
}
//Class Book
class Book
{
//Properties
public string title { get; set; }
public string author { get; set; }
public string publisher { get; set; }
public int isbn { get; set; }

//method to get book details
public void getBook(string Title,string Author,string Publisher,int Isbn)
{
//assigning title
this.title = Title;
//assigning author
this.author = Author;
//assigning publisher
this.publisher = Publisher;
//assigning isbn
this.isbn = Isbn;
}
//method to display book details
public virtual void displayBook()
{
//display book details
Console.WriteLine($"Title :{this.title} , Author :{this.author},Publisher : {this.publisher},ISBN :{this.isbn}");
}
}
//Class Textbook inhetits from class Book
class Textbook :Book
{
//Properties
public string category { get; set; }
public int edition { get; set; }
//display category and edition
public override void displayBook()
{
base.displayBook();//calling base class method
Console.WriteLine($"Category :{this.category} , Edition :{this.edition}");
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :

C:WINDOWS)system321cmd.exe Enter Title :Getting Started with Angular7 Enter Author :Barry Army Enter Publisher Wing Pubs Ente

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
ALL DONE IN C# PLEASE Write a class, including all necessary methods and members, to represent...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c) Create a class called OpenReq that has all the necessary members and methods for a...

    c) Create a class called OpenReq that has all the necessary members and methods for a new job opportunity. Among others you could think necessary, your class should include the following members: . Job Title . Skills (better to have them as a set) . City State . Country Short Description . Hiring Manager . Salary . ApplicantList, the list of applicants for the job Among others you could think necessary, your class should include the following methods: . changeHiringManagerO)...

  • Develop a C++ Project that Apply the OOP concept of separations between the specifications (Book.h), implementations...

    Develop a C++ Project that Apply the OOP concept of separations between the specifications (Book.h), implementations (Book.cpp) and Client (main.cpp). The Class Book that manages the books should include the attributes: ISBN, category, title, author, price and pageCount. Write getters and setters methods for each attribute. The class should include two different constructors, one with ISBN and one with title and author. Add a method to input a new book details, a method to purchase and calculate total cost, a...

  • Use object-oriented design to design a parent class called Book that will receive the ISBN, author,...

    Use object-oriented design to design a parent class called Book that will receive the ISBN, author, title and price of a book, and select and print records for al books with a price of more than $50.00. Design a child class called TextBook that will use the existing methods of its parent class and receive an extra data field called grade that can be a number from 0 to 12. This class is to select and print records of all...

  • A java class named Book contains: instance data for the title, author, publisher and copyright year...

    A java class named Book contains: instance data for the title, author, publisher and copyright year a constructor to accept and initialize the instance data variables set and get methods a toString() method to return a formatted, multi-line description of the book Produce a child class that inherits from Book. The class is called Dictionary. Dictonary must include: instance data that describes the number of words in the dictionary a constructor that takes in all information needed to describe a...

  • cs55(java) please. Write a class called Book that contains instance data for the title, author, publisher,...

    cs55(java) please. Write a class called Book that contains instance data for the title, author, publisher, price, and copyright date. Define the Book constructor to accept and initialize this data. Include setter and getter methods for all instance data. Include a toString method that returns a nicely formatted, multi-line description of the book. Write another class called Bookshelf, which has name and array of Book objects. Bookself capacity is maximum of five books. Includes method for Bookself that adds, removes,...

  • 1- Create the base class Book that has the following instance variables, constructor, and methods title...

    1- Create the base class Book that has the following instance variables, constructor, and methods title ( String) isbn ( String) authors (String) publisher (String) edition ( int) published_year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method // that return sting representation of Book object. 2- Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title ( String) isbn...

  • C++ In this homework, you will implement a single linked list to store a list of computer science textbooks. Ever...

    C++ In this homework, you will implement a single linked list to store a list of computer science textbooks. Every book has a title, author, and an ISBN number. You will create 2 classes: Textbook and Library. Textbook class should have all above attributes and also a "next" pointer. Textbook Туре String String String Attribute title author ISBN Textbook* next Library class should have a head node as an attribute to keep the list of the books. Also, following member...

  • C# programming 50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (Strin...

    C# programming 50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (String) edition ( int) published year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method// that return sting representation of Book object. 2-Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title...

  • You need to program a simple book library system. There are three java classes Book.java   //...

    You need to program a simple book library system. There are three java classes Book.java   // book object class Library.java   //library class A2.java //for testing The Book.java class represents book objects which contain the following fields title: a string which represents the book title. author: a string to hold the book author name year: book publication year isbn: a string of 10 numeric numbers. The book class will have also 3 constructors. -The default no argument constructor - A constructor...

  • C# assistance please help Write the source code for a C# program (i.e., a separate class)...

    C# assistance please help Write the source code for a C# program (i.e., a separate class) named “BookDemo” that uses the Book class below and does the following in the Main method of BookDemo: 1) Declare local variables for book title and author, and initialize the variables to “C# Programming” and “Farrell” 2) Instantiate a Book object using the information from Step 1 3) Print the summary of the book object using the displaySummary() method in the Book class class...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT