Skip to content

Assignment 5 (Error Handling in Car Accident scenario)#5

Open
mukulpalol16 wants to merge 8 commits intomainfrom
Assignment5
Open

Assignment 5 (Error Handling in Car Accident scenario)#5
mukulpalol16 wants to merge 8 commits intomainfrom
Assignment5

Conversation

@mukulpalol16
Copy link
Owner

No description provided.

@mukulpalol16 mukulpalol16 marked this pull request as ready for review April 2, 2024 08:42
@mukulpalol16 mukulpalol16 marked this pull request as draft April 2, 2024 09:05
Copy link
Collaborator

@Poyam-ITT Poyam-ITT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good to me.

Copy link
Collaborator

@nitintayal008 nitintayal008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@mukulpalol16 mukulpalol16 marked this pull request as ready for review April 3, 2024 06:59
{
Console.WriteLine("Car is running.");
DrivingScenario scenario = (DrivingScenario)new Random().Next(1, 6); // Simulate random car failure/accident scenarios
switch (scenario)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be done without switch case as it breaks OCP.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used switch case just so I can simulate different accident scenarios randomly. In actual case, we would have a method inside the Run method which will throw any of the exceptions that we'll get.
Let me know what you think about it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it is ok else everything looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants