Code Monkey home page Code Monkey logo

btc-atm-machine's Introduction

Bitcoin ATM Machine - OOC Project

Overview

Bitcoin ATM Machine (BTM) is a machine that allows users to buy and sell bitcoin through a bitcoin Automated Teller Machine. The objective of this project is as follow:

  • Create an intuitive GUI that facilitates easy navigation and interaction for users during both buying and selling transactions.
  • Provide a seamless experience for users, regardless of their level of familiarity with cryptocurrencies.

System Main Functions

  1. Authentication
  2. User: Customer
    • Deposit
    • Withdraw
    • Display User Wallet
    • Display Transaction
  3. User: Admin
    • Display all transaction

Classes List:

  1. User Class: Admin & Customer (Sub Class)
  2. Currency Class: Store currencies & exchange rate
  3. Transaction class: Write Transaction to transactions.txt
  4. IdGenerator class: Generate ID
  5. Login Class: Login User based on accounts.txt
  6. Register Class: Register new Users on accounts.txt
  7. TransactionReader: Read data from txt file
  8. Auth Class: Auth flow for BTM
  9. AnonClass: Anonymous Inner Class

Inheritance

Inheritance is a fundamental object-oriented programming (OOP) concept that allows a class (subclass or derived class) to inherit the properties and behaviors of another class (superclass or base class).

  • User is the super class
  • Admin & Customer are the sub class of User, we use inheritance for better code structure and also for the difference between the 2 kind of User. The difference between the 2 sub-class is that Admin can display every transaction of the user while for customer, they can only display the transaction based on a specific userID.

Encapsulation

Encapsulation is an OOP principle that involves bundling the data (attributes) and methods (functions) that operate on the data into a single unit, known as a class.

  • Getter & Setter functions in every classes
  • Usage of Public, Private, Protected accessor is to allow us to encapsulate our code and define clear visibility for classes and members.
  • We use Public in User class getUserID() and for every ther accessore, so that Customer class and Adim class can use it as well.

Abstraction

Abstraction is the process of hiding the complex implementation details and exposing only the essential features of an object.

  • User is an abstract class
  • displayAllTransactions() is an abstract method in Customer and Admin class, where in the Admin class, it display the transaction from the file regardless the user and for the method in Customer class, it display a specific transaction based on the userID.

Polymorphism

Polymorphism allows objects of different types to be treated as objects of a common type.

  • Overriding functions: toString() can be found in Customer class. It provides a custom string representation for an object, including the default string representation from the User class and appending information about the balance of the customer in BTC and the other one is in Transaction class where it return the values in string and also to make it easier to debug or log information about transactions in your application.
  • equals() this override from object class(root class), this block checks if the fullName and phoneNumber fields of the current instance (this) and the tmpUser instance are equal. If both conditions are true, it returns true, indicating that the two User objects are considered equal.
  • Overloading functions: checkBalance() in Customer Class.

Exception Handling

Exception handling is a mechanism for dealing with errors during program execution.

  • IOException for reading files error in Customer class to catch the unwanted input and block the execution and also to find the right path
  • NoSuchElementException for No User Found (Query Data) also in Customer class.
  • NumberFormatException, can be found in customer class in getBalanceFromAccountFile method, which this execution when Double.parseDouble(parts[5]) encounters a NumberFormatException. The Double.parseDouble() method is used to convert the string value at parts[5] into a double.

File I/O

File I/O (Input/Output) involves reading from and writing to files.

Static Methods

Static methods belong to a class rather than an instance of the class.

Interface

An interface defines a contract for a set of methods that a class must implement. In this code, we implemented interface in Currency class.

  • CurrencyInterface

btc-atm-machine's People

Contributors

pisothyi avatar hvicheara avatar

Stargazers

 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.