Class Libraries / Classes & Focusing on OOP

This was actually a challenge lesson from a course I’ve been taking. The lesson instructor actually gave us some program requirements. The challenge was a dart game of 300. I had to create a re-usable class library for the Darts class that has to be used by the 300 game. The idea was that this class could be used no matter what type of dart game was being played. Be it a game of 300, high score game, etc… Each game could refer to this class library for the basic methods, properties etc.., to function. This game was really simple in¬† nature. Each player has 3 chances, or darts to throw each round. The first player to get 300 or more wins the game. Sounds simple huh? It was actually¬† more involved the more I got into programming this along with following the requirements. I won’t list ALL of the requirements as you can guess they got pretty involved. Things like what the score was if the dart hit the inner bulls-eye or outer bulls-eye, if the darts lands in the inner or outer bands, calculating and updating the score, displaying the results, etc… And trying to keep my methods within 6-10 lines of code. Whew!!!! Again if you want to download the source-code you can via the download page. I’ve included comments in the code to try and explain what I’m doing the best that I can. It will probably help some of the gaps because I’ll no doubt leave holes in my descriptions below. And if you have any questions leave a comment below. I will probably come back to this program later and add more classes to the class library based on different types of games. maybe, so stay tuned.

Continue reading

Advertisements