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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started