Design a menu manager with enums
Company: CloudKitchens
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Design and implement a console-based restaurant menu management program. Requirements:
(
1) There are exactly three fixed item categories represented by an enum (e.g., APPETIZER, MAIN, DESSERT).
(
2) Support addItem(name, price, category), updatePrice(name, newPrice), removeItem(name), listAll(), and listByCategory(category).
(
3) Print items using each object's toString() rather than accessing fields via getters; list output grouped by category and sorted alphabetically within each category.
(
4) Choose data structures to achieve O(
1) add/update/remove by name and O(k log k) listing within a category (k = number of items in that category).
(
5) Provide a simple CLI that reads commands from stdin and executes them, plus basic unit tests.
Quick Answer: This question evaluates data modeling with enums, efficient data structure selection to meet specified time complexities, API design for CRUD operations, and practical implementation skills including a command-line interface and unit testing.