A class representing a bookstore with inventory management.

import { Book } from "./Book";
import { BookStore } from "./BookStore";

// Initialize bookstore
const bookstore = new BookStore("The Corner Bookshop", "Downtown");

// Add inventory
const book1 = new Book("1984");
const book2 = new Book("Pride and Prejudice");

bookstore.addToInventory(book1);
bookstore.addToInventory(book2);

// Check stock
console.log(`Books in stock: ${bookstore.getInventoryCount()}`);
console.log(`Has '1984': ${bookstore.hasBook("1984")}`);
console.log(`Store: ${bookstore.name} at ${bookstore.location}`);
Inventory management (excluding pricing logic)

Constructors

Properties

inventory: Book[] = []
location: string
name: string

Methods

  • Parameters

    • title: string

    Returns boolean