Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApp2
- {
- //student class
- class Student
- {
- public string s_id;
- public string s_name;
- public void setS_id(String s_id)
- {
- this.s_id = s_id;
- }
- public string getS_id()
- {
- return this.s_id;
- }
- public void setS_name(String s_name)
- {
- this.s_name = s_name;
- }
- public string getS_name()
- {
- return this.s_name;
- }
- }
- //book class
- class Book
- {
- public string isbn;//book id
- public string title;// book title
- public string author;
- public string subject;
- public string shelf_id;//shelf number
- public string shelf_author;
- //getter / setter
- public void setTile(String title)
- {
- this.title = title;
- }
- public string getTile()
- {
- return this.title;
- }
- }
- class Student_Card
- {
- public string card_id;
- public Student student;
- public void setStudent(Student student)
- {
- this.student = student;
- }
- }
- //library
- class Library
- {
- public string name;
- public string librarian_name;
- public List<Student> borrowerlist = new List<Student>();
- public void createLibrarian(string librarian_name)
- {
- this.librarian_name = librarian_name;
- }
- public void student_enroll(Student stdt, Student_Card demo_crad)
- {
- demo_crad.setStudent(stdt);
- }
- public void giveBook(Student_Card card)
- {
- borrowerlist.Add(card.student);
- }
- public void showList()
- {
- foreach (Student std in borrowerlist)
- {
- Console.WriteLine("Name: " + std.getS_name());
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Staring app.....");
- Library iubatLib = new Library();
- iubatLib.name = "IUBAT Library";
- iubatLib.createLibrarian("Mimma");
- //done creteing Library
- Student toma = new Student();
- toma.s_id = "18103081";
- toma.setS_name("Toma ");
- Student toma2 = new Student();
- toma2.s_id = "181030821";
- toma2.setS_name("Toma2 ");
- //student card creating
- Student_Card card1 = new Student_Card();
- card1.card_id = "card 1";
- card1.setStudent(toma);
- Student_Card card2 = new Student_Card();
- card2.card_id = "card 2";
- card1.setStudent(toma2);
- //book create
- Book b = new Book();
- b.isbn = "123";
- b.title = "Liluya batas";
- b.author = "Humayun Ahmed";
- b.subject = "Nobel";
- b.shelf_id = "321";
- b.shelf_author = "tama";
- iubatLib.giveBook(card1);
- iubatLib.giveBook(card2);
- //show the list
- iubatLib.showList();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement