Question: Using C#, Write a program with a Book class, that contains: Four private fields: a. string title b. string author c. double price d. string

Using C#,

Write a program with a Book class, that contains:

Four private fields:

a. string title

b. string author

c. double price

d. string isbn

A constructor: public Book(string title, string author, double price, string isbn).

Four public properties with getter/setter for the four fields: Title, Author, Price, and ISBN

A method public void printInfomation(), which prints out the book information in the format of title written by author is price, with ISBN isbn For example, Pride and Prejudice written by Jane Austen is 5.97 dollars, with ISBN 0141439513

In the Main method, first read in the number of books, and an instruction number from the console. They are separated by a space, such as 2 1 (2 books, option1). Then read in the information of each book including title, author, price, and isbn in each line (See example input). You need to use these information to construct Book object using the Book class. Use Array or List to store these Book objects. The instruction number is either 1 or 2.

1) For option 1, sort all the books with price in the ascending order, and use the printInfomation() method in the class to print all of them in each line.

2) For option 2, sort all the books with book title alphabetically, and use the printInfomation() method in the class to print all of them in each line.

You may choose any sorting method in this assignment.

Example input and output are provided below. Input is in bold.

Example 1:

2 1

Professional C# 6 and .NET Core 1.0

Christian Nagel

42.12

111909660X

Pride and Prejudice

Jane Austen

5.97

0141439513

Pride and Prejudice written by Jane Austen is 5.97 dollars, with ISBN 0141439513

Professional C# 6 and .NET Core 1.0 written by Christian Nagel is 42.12 dollars, with ISBN 111909660X

Example 2:

3 2

Professional C# 6 and .NET Core 1.0

Christian Nagel

42.12

111909660X

Pride and Prejudice

Jane Austen

5.97

0141439513

Beginning C# 6 Programming with Visual Studio 2015

Benjamin Perkins

30.65

1119096685

Beginning C# 6 Programming with Visual Studio 2015 written by Benjamin Perkins is 30.65 dollars, with ISBN 1119096685

Pride and Prejudice written by Jane Austen is 5.97 dollars, with ISBN 0141439513

Professional C# 6 and .NET Core 1.0 written by Christian Nagel is 42.12 dollars, with ISBN 111909660X

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!