You are given a program that models drivers communicating over a hardware bus.
The current design is incorrect because:
Your task is to fix the design without changing the behavior or output.
What the Program Must Achieve (End Goal):
Bus
What Is Given to You:
What You Must Change (Very Explicit):
Driver
In short:Replace inheritance with composition so the bus can be shared.
Program Flow:
Input:Four integers
addr1 val1 addr2 val2
Output (Exact Order):
Bus ready Driver started Driver started Bus write: <addr1> <val1> Bus write: <addr2> <val2> Driver stopped Driver stopped Bus stopped
Constraints:
write()
Test Cases
Test Results
Input
10 20 30 40
Expected Output
Bus ready Driver started Driver started Bus write: 10 20 Bus write: 30 40 Driver stopped Driver stopped Bus stopped