GithubHelp home page GithubHelp logo

carddecks-oop-version's Introduction

CardDecks-OOP-version

This is the Object-Oriented programming version of the CardDecks class. There are 3 classes: Card, Deck, and Main.

The Deck class creates new cards objects by calling the constructor of the Card class. Then it creates a deck of cards by adding all the cards to the deck ArrayList, shuffles all the cards, and implements the dealCards method which will remove numCards number of different cards from the original ArrayList and returns a new ArrayList with the the numCards number of cards(here numCards is 5).

The Main class prints out the deck before and after shuffling the cards. Then, it calls the dealCards method and prints out the sum of the values of the numCards number of cards and it calls the dealCards method to find sum of another 5 different cards.

The Card class returns the value of the card and it overrides the toString() method from the Object class to return the face and suit of the cards.

Programming Concepts used in this project: Object Oriented Programming concepts- Encapsulation(created 3 different class with their own private instance variables and methods), abstraction(used private identifiers), and Polymorphism(the toString() class of the Object class was overridden by both the Card and Deck class).

carddecks-oop-version's People

Contributors

sakshamsangraula avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.