c.C#.Net program to write an application that declares two books objects and uses an extension method named display title and author() with each.The method display a books title,the word"by",and author name .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Book
{
class BookDemo03
{
static void Main(string[] args)
{
int BookPrice;
string textBook;
Boolean rs = false;
TextBook Textbook = new TextBook();
TextBook CoffeeTableTextBook = new TextBook();
int option;
while (rs != true)
{
Console.WriteLine("Please choose Between:");
Console.WriteLine(0 + ".Exit the Library");
Console.WriteLine(1 + ".TextBook");
Console.WriteLine(2 + ".Coffee Table Book ");
option = Convert.ToInt32(Console.ReadLine());
switch (option)
{
case 0:
Environment.Exit(0);
break;
case 1:
Console.WriteLine("Enter Textbook Name");
textBook = Console.ReadLine();
Console.WriteLine("Enter ISBN Number");
String ISBN = Console.ReadLine();
Console.WriteLine("Enter Book Price:");
BookPrice = Convert.ToInt32(Console.ReadLine());
if (BookPrice <= 25 && BookPrice <=
80)
{
Console.WriteLine("Valid Amount please collect your book");
}
{
if (BookPrice < 25 || BookPrice > 80)
Console.WriteLine("Invalid Amount!! ");
Console.WriteLine("\n");
Console.WriteLine("\n");
Console.WriteLine("TextBook Name: " + textBook + "\n" + "ISBN: " +
ISBN + "\n" + "Book Price: " + "$" + BookPrice);
}
break;
case 2:
Console.WriteLine("Enter Coffee Table Book Name");
textBook = Console.ReadLine();
Console.WriteLine("Enter ISBN Number");
String ISBN2 = Console.ReadLine();
Console.WriteLine("Enter Book Price:");
BookPrice = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\n");
Console.WriteLine("\n");
Console.WriteLine("Coffee Table Book Name: " + textBook + "\n" +
"ISBN: " + ISBN2 + "\n" + "Book Price: " + "$" + BookPrice);
if (BookPrice <= 35 && BookPrice <= 100)
{
Console.WriteLine("Valid book! please collect your book");
}
{
if (BookPrice < 35 || BookPrice > 100)
Console.WriteLine("\n Invalid Amount!!\n");
}
break;
default:
Console.WriteLine("\n invalid Option Try again");
Console.WriteLine("Choose an option");
option = Convert.ToInt32(Console.ReadLine());
break;
}
}
}
}
}
In the Book class you created in Exercise 4a, overload the Object class Equals() method to...
In Java
Create an interface called
Amount
that includes a method called
setPrice
().
Create an abstract class named
Book
that inherits from the interface Amount. Include a String field
for
the book’s
title
and a double field for the book’s
Price
. Within the class, include a constructor that
requires the book title and add
two getter methods
— one that returns the title and one that returns the
price. Include an abstract method named
setPrice
().
Create a...
Implement the classes in the following class diagram. The Book class implements the Comparable interface. Use implements Comparable<Book> in the class definition. Now, all book objects are instances of the java.lang.Comparable interface. Write a test program that creates an array of ten books. 1. Use Arrays.sort( Book[]l books) from the java.util package to sort the array. The order of objects in the array is determined using compareTo...) method. 2. Write a method that returns the most expensive book in the...
Create a class named Book that contains data fields for the title and number of pages. Include get and set methods for these fields. Next, create a subclass named Textbook, which contains an additional field that holds a grade level for the Textbook and additional methods to get and set the grade level field. Write an application that demonstrates using objects of each class. Save the files as Book.java, Textbook.java, and DemoBook.java.
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...
Create a Ruby class Book1. Each book is characterized by the instance variables authnr rf t class . For this class create the initializer and the method show1 that displays the instance variables of the Bookl. class Create the class Book2 that inherits properties from the class Bookl and ad variables publisher and price. Write the following Book2 methods e read2 that prompts the user and reads from the keyboard all data for Book e show2 that displays all instance...
Using C#: Create an application class named BillDemo that instantiates objects of two classes named Bill and OverdueBill, and that demonstrates all their methods. The Bill class includes auto-implemented properties for the name of the company or person to whom the bill is owed and for the amount due. Also, include a ToString() method and returns a string that contains the name of the class (using GetType()) and the Bill’s data fields values. Create a child class named OverdueBill that...
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...
C# Create an application named JobDemo that declares and uses Job objects. The Job class holds job information for a home repair service. The class has five properties that include: JobNumber - The job number Customer - The customer name Description - The job description Hours - The estimated hours price - The price for the job Create a constructor that requires parameters for all the data except price. Include auto-implemented properties for the job number, customer name, and job...
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,...
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...