Computer Science homework help. CPSC 3200 Object-Oriented Development
P3 exercises your understanding of Inheritance and practice Dependency Injection
For an acceptable P3 submission:
- Write your program in C# and use MS Test
- Design using inheritance and Dependency Injection
- Fulfill requirements as specified in steps 1-9 from P1
- Upload all files (NOT a project) to Canvas (sensor.cs, robot.cs, actuator.cs, RotatingRobot.cs, TranRobot.cs, driver.cs, sensorTest.cs, actuatorTest.cs, robotTest.cs, RotatingRobotTest.cs, TranRobotTest.cs)
Part I: Class Design
- Design a type extension of Robot, a rotating robot. A RotatingRobot has multiple sensors to check ‘left’, ‘right’, and ‘forward’. With the additional sensors RotatingRobot will be able to support all the functionality of a Robot plus:
Rotate() – changes the facing direction of the RotatingRobot either to the left direction (90 degrees) or to the right direction (90 degrees). Rotate does not change the position on the grid of the robot.
Rotate() is the only additional functionality of the RotatingRobot. ALL the prior methods of Robot should still be present and implemented appropriately for a ‘RotatingRobot’.
- Design a type extension for Robot, a translating robot. A TranRobot has multiple sensors to check ‘left’, ‘right’, ‘forward’, and ‘backward’. With the additional sensors TranRobot will be able to support all the functionality of a Robot plus:
Left(), Right(), Forward(), Back() – These methods change the position on the grid of the robot.
These methods are the only required additional functionality of the TranRobot. ALL the prior methods of Robot should still be present and implemented appropriately for a ‘TranRobot’.
Part 2: Dependency Injection
In P2, grid.txt was used. In P3, appropriately used dependency injection as is appropriate and documented for this dependency on the grid. This was not expected in P2 as we had not yet covered Dependency Injection.
Many details are missing. You MUST make and DOCUMENT your design decisions!!
Do NOT tie your type definition to the Console.
Use Unit Testing to verify functionality of each class => 5 test files. Sensor, Actuator, Robot, TranRobot, RotatingRobot.
Part II: Driver (P3.cs) — External Perspective of Client – tests inheritance hierarchy design
The P3 driver must be an extension of the testing done in P2 and must test the use of all 5 types together.
Thus, it will differ from the unit tests which test each type separately.
- Use at least one heterogeneous collection for testing functionality
- Instantiate a variety of objects
- Trigger a variety of mode changes