Oracle | Onsite | Design Calculator Using Composite Pattern
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-12-07Added By Anonymous
Source: Link
Company: Oracle
Role: ic-2
Interview Stage: Onsite
Location: unknown
Year: unknown
Original Post Content:
Description:
I was asked in an Oracle onsite interview to design a calculator using the Composite design pattern. The problem involves creating a system where mathematical expressions like 2 + (3 * 4) can be represented and computed.
Problem Statement:
Design a calculator using the Composite design pattern. The calculator should support operations such as addition, subtraction, multiplication, and division. Nested expressions like (2 + (3 * 4)) should also be supported.
Please UPVOTE if you find helpful.