Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tulsa.NET User Group INTRO TO OBJECT ORIENTED PROGRAMMING.

Similar presentations


Presentation on theme: "Tulsa.NET User Group INTRO TO OBJECT ORIENTED PROGRAMMING."— Presentation transcript:

1 Tulsa.NET User Group INTRO TO OBJECT ORIENTED PROGRAMMING

2 DisplayAboutMe(host); >Sean Whitesell President of Tulsa.NET User Group Sr. Developer at OpenLink Financial seanw122@gmail.comseanw122@gmail.com @seanw122

3 Special thanks to…

4 What is OOP? Object Oriented Programming Creation of Classes and Interfaces Polymorphism

5 But first, a challenge POKER HANDS Import file Each line is cards for both players Each line is a round Determine winner of each round using poker rules for comparing hands. Determine how many times player 1 wins Player 1Player 2 Round 12C AD JH TC 5S2S 4H JH 3D 2D Round 26H 7D 8H 9C TS8D 3S 5D 5C AH Round 34H AS JS QS QC8C 8H 3S TH 9D

6 Poker Challenge projecteuler.net/problem=54 Test project file on that page Judging by me supplying a new file to your code I’ll know how many times player 1 should win Judged by correct answer, speed, then code. Submit executable and source code.

7 Example from site Hand Player 1 Player 2 Winner 1 5H 5C 6S 7S KD Pair of Fives 2C 3S 8S 8D TD Pair of Eights Player 2 2 5D 8C 9S JS AC Highest card Ace 2C 5C 7D 8S QH Highest card Queen Player 1 3 2D 9C AS AH AC Three Aces 3D 6D 7D TD QD Flush with Diamonds Player 2 4 4D 6S 9H QH QC Pair of Queens Highest card Nine 3D 6D 7H QD QS Pair of Queens Highest card Seven Player 1 5 2H 2D 4C 4D 4S Full House With Three Fours 3C 3D 3S 9S 9D Full House with Three Threes Player 1

8 Rules for Comparing Hands High Card:Highest value card. One Pair:Two cards of the same value. Two Pairs:Two different pairs. Three of a Kind:Three cards of the same value. Straight:All cards are consecutive values. Flush:All cards of the same suit. Full House:Three of a kind and a pair. Four of a Kind:Four cards of the same value. Straight Flush:All cards are consecutive values of same suit. Royal Flush:Ten, Jack, Queen, King, Ace, in same suit.

9 O bject O riented P rogramming And you

10

11 Object PropertiesMethods

12 DogCat LionHorse Animal

13 Houses VillaApartments DuplexRanch

14 Contacts VendorsCustomers EmployeesIRS

15 House Building “Is A” Inheritance

16 House Room Composition “Has A” Room cannot exist without a house

17 House Occupant Aggregation “Has A / An” The two objects can exist independently.

18 Public void SolveChallenge() { var foo = File.OpenText(“C:\\temp\\poker.txt”; foreach ( var line in foo) { blah } compare each card…. is Royal Flush is Straight Flush is Four of a Kind is Straight is Three of a Kind … } Don't Do This!

19 Main Class Card PlayerHand Winner

20 http://faculty.orangecoastcollege.edu/sgilbert/book/03-4-ObjectOrientedConcepts-B/index.html Polymorphism allows objects to behave differently

21 Ship ( IShipMethod) IShipMethod USPS UPS FedEx

22 Pay( IPaymentMethod) IPaymentMethod Visa Mastercard PayPal


Download ppt "Tulsa.NET User Group INTRO TO OBJECT ORIENTED PROGRAMMING."

Similar presentations


Ads by Google