Challenge: Guard Clauses with Custom Exceptions
Завдання
Swipe to start coding
Implement a method for a product ordering system that enforces stock limits using guard clauses and a custom exception.
- If the requested quantity is greater than the available stock, the method must throw an
OutOfStockException. - If the requested quantity is within the available stock, the stock must be reduced by the ordered quantity.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 6
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Чудово!
Completion показник покращився до 4.17
Challenge: Guard Clauses with Custom Exceptions
Свайпніть щоб показати меню
Завдання
Swipe to start coding
Implement a method for a product ordering system that enforces stock limits using guard clauses and a custom exception.
- If the requested quantity is greater than the available stock, the method must throw an
OutOfStockException. - If the requested quantity is within the available stock, the stock must be reduced by the ordered quantity.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 6
single