Build a console application for a candy shop that demonstrates object-oriented programming concepts through inheritance and composition patterns.
- The shop sells different types of candy: chocolates, gummies, and hard candies
- Each candy has basic information: name, price, and sweetness level
- Each candy type has unique characteristics that need to be tracked
- The system must display candy information in a user-friendly format
- Display Cases: Used to organize inventory by candy type
- Each display case contains only one kind of candy (all chocolates, all gummies, etc.)
- Display cases show what type of candy they contain and how many items are in stock
- Staff should be able to add candy to the appropriate display case
- Party Baskets: Used for customer orders and gift combinations
- Party baskets can contain any mix of candy types
- Customers should be able to add any candy to their basket
- The system should calculate total prices and show basket contents
- Create a base candy class with common properties and behaviors
- Implement specialized candy types that extend the base class
- Demonstrate code reuse and polymorphism through inheritance
- Use virtual methods and method overriding appropriately
- Flexible Composition: Implement containers that can hold multiple object types
- Constrained Composition: Implement containers restricted to single object types
- Compare and contrast when to use each approach
- Demonstrate object relationships using "has-a" vs "is-a" concepts
- Apply encapsulation principles with appropriate access modifiers
- Design class relationships that model real-world scenarios
- Create maintainable and extensible code structures
- Demonstrate polymorphic behavior in collections
For Inheritance:
- All candy types share common functionality from base class
- Each candy type displays its unique information correctly
- Polymorphism works when treating different candies uniformly
For Composition:
- Display cases enforce business rules (single candy type only)
- Party baskets allow flexible combinations
- Both container types manage their contents appropriately
For Application:
- Console app demonstrates all classes working together
- User can see the difference between organized inventory and mixed collections
- Code is readable, well-structured, and demonstrates OOP principles