Wednesday, 24 April 2013

As a part of the team that is developing software for a library, you have been assigned the task of writing a program. The program should accept the following book details: 1. Book Number as int 2. Book Category (Fiction or Nonfiction) as string 3. Author Name as string 4. Number of copies available as int Write a C# program to accept and display the preceding book details. (Duration: 45 min)


using System;
class Book
{
     string BookCat;
     string FirstName;
     string LastName;
     int IsbnNo;
     int NoOfCopies;

   public void display()
{
      Console.WriteLine("\nThe following are the details of the Book:");
      Consile.writeLine("Category of the Book:");
      Console.write("Name of the Author:");
      Console.Write(FiretName);
      Console.writeLine("{0}",LastName);
      Console.Write("ISBN Number:");
      Console.WriteLine(IsbnNo);
      Console.Write("Number of Copies");
      Console.WriteLine(NoOfCopies);
}
  public void Get()
{
  Console.WriteLine("Please enter the details of the Book");
  Console.WriteLine("Enter the Category of the Book(Fiction/Nonfiction):");
  BookCat=Console.ReadLine();
  Console.WriteLine("First Name of the Author:");
  FirstName=console.ReadLine();
  Console.WriteLine("Last Name of the Author:");
  LastName=console.ReadLine();
  Console.WriteLine("ISBN Number:");
  IsbnNo= Convert.toInt32(Console.ReadLine());
  Console.WriteLine("Number of Copies:");
  NoOfCopies=Convert.TOInt32(Console.ReadLine());
 }
}
    class MyClass
 {
     static void Main(string[] args)
{
     Book My_Fav = new Book();
     Console.readLine();
    }
  }

No comments:

Post a Comment