Exemplo n.º 1
0
        public void ReturnBook(Borrow b)
        {
            int crDay = DateTime.Now.Day;

            if (crDay - b.Day > 5)
            {
                double amount = (crDay - b.Day - 5) * 10;
                b.Student.Account.Transfer(amount, this.Account);
                Console.WriteLine("Book Returned with charges of {0} day; Amount {1}", (crDay - b.Day - 5), amount);
            }
            else
            {
                Console.WriteLine("Book Returned with no charges");
            }
        }
Exemplo n.º 2
0
        public void ReturnBook(Student s, Borrow b)
        {
            int crDay = DateTime.Now.Day;

            if (crDay - b.Day > 5)
            {
                double amount = (crDay - b.Day - 5) * 10;
                s.Account.Transfer(amount, this.Account);
                Console.WriteLine("You have charged with {0} taka for {1} days late", amount, (crDay - b.Day - 5));
            }
            else
            {
                Console.WriteLine("Successfully returned with no charge");
            }
        }
Exemplo n.º 3
0
 public void AddBorrow(Borrow borrow)
 {
     borrows[BorrowCount++] = borrow;
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Library l1 = new Library("Aiub Library");

            Book b1 = new Book("Padma Nadir Majhi", "Manik", "1001", 10);
            Book b2 = new Book("Hajar Bochor Dhore", "Zahir", "1002", 4);
            Book b3 = new Book("Harry Potter 1", "J.K", "1003", 5);
            Book b4 = new Book("Harry Potter 2", "J.K", "1004", 4);

            l1.AddBook(b1, b2, b3, b4);

            //l1.ShowAllBooks();

            var temp = l1.SearchBook("1004");

            if (temp != null)
            {
                l1.AddNewBookCopy(temp, 5);
            }
            Book b5 = new Book("C++ The complete referecne", "Herbert Schildit", "1005", 10);

            l1.AddBook(b5);
            Console.WriteLine("-------------------------------");
            //l1.ShowAllBooks();

            Student s1 = new Student("Tanvir", "1001");
            Student s2 = new Student("Maruf", "1002");

            Borrow br1 = new Borrow("br-001", 7, s1);

            br1.AddBook(b1, b2);
            s1.AddBorrow(br1);
            Borrow br2 = new Borrow("br-002", 8, s2);

            br2.AddBook(b3, b4);
            s2.AddBorrow(br2);

            Borrow br3 = new Borrow("br-003", 4, s1);

            br3.AddBook(b5);
            s1.AddBorrow(br3);

            //s1.ShowAllBorrows();

            l1.AddBorrow(br1);
            l1.AddBorrow(br2);
            l1.AddBorrow(br3);

            //l1.ShowAllBorrows();

            Account a1 = new Account("Tanvir", "10001", 500.00);

            s1.Account = a1;

            Account a2 = new Account("Library", "1002", 10000.00);

            l1.Account = a2;

            l1.ReturnBook(br1);
            l1.ReturnBook(br3);

            Console.WriteLine("Student Balance: " + s1.Account.Balance);
            Console.WriteLine("Library Balance: " + l1.Account.Balance);
        }
Exemplo n.º 5
0
 public Library(string name)
 {
     Name        = name;
     listOfBooks = new Book[100];
     borrows     = new Borrow[1000];
 }
Exemplo n.º 6
0
 public Library()
 {
     listOfBooks = new Book[100];
     borrows     = new Borrow[1000];
 }