Lesson 34 of 34

Mini Project: Library ManagementMini Project: Library Management

15 min 50 XP

இதுவரை கற்றதை ஒரு சிறிய project-ல் இணைப்போம். Library-ல் புத்தகங்கள் உள்ளன; மாணவர்கள் புத்தகம் எடுக்கலாம் (borrow), திருப்பித் தரலாம் (return). ஒவ்வொரு command-ம் ஒரு வரியாக வரும்.

Let's combine everything into a small project. A library has books; students can borrow and return them. Each command arrives as one line of input, just like a real coding-round problem.

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

இந்த project-ஐ உங்கள் resume-ல் சேர்க்கலாம்: GitHub-ல் போட்டு, due date, fine போன்ற அம்சங்களைச் சேர்த்துப் பெரிதாக்குங்கள்.

Put this project on your resume: push it to GitHub and grow it with due dates and fines.

Challenge

+50 XP

Commands-ஐப் படித்து library-ஐ இயக்குங்கள். முதல் வரி: command எண்ணிக்கை n. ஒவ்வொரு command: ADD id title (title ஒரு சொல்) → எதுவும் print இல்லை BORROW id → "Borrowed title", ஏற்கனவே எடுக்கப்பட்டிருந்தால் "title is already borrowed", இல்லாத id-க்கு "No such book id" RETURN id → "Returned title" (எடுக்கப்படாதிருந்தால் "title was not borrowed") COUNT → "Available: k"

Run a library from commands. The first line is n, the number of commands. Each command is one of: ADD id title (title is one word) → prints nothing BORROW id → "Borrowed title", or "title is already borrowed", or "No such book id" for an unknown id RETURN id → "Returned title", or "title was not borrowed" COUNT → "Available: k"

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.