Giter Club home page Giter Club logo

my_atm_csharp's Introduction

My ATM Project in C#

ATM Functions

  • Withdraw Money
  • Deposit Money
  • Check Balance

Bank Users

  • First Name
  • Last Name
  • Card Number
  • PIN
  • Account Balance

This C# code is part of a simple ATM machine simulation. It starts by defining a list of cardHolder objects, each representing a bank account with a card number, pin, first name, last name, and balance.

The Main method begins by initializing a list of cardHolder objects, cardHolders, and populating it with four card holders. Each card holder is created using the cardHolder constructor, which takes five arguments: card number, pin, first name, last name, and balance.

The program then prints a welcome message and prompts the user to enter their card number.

After the Main method, a debitCardNum string and a currentUser object of type cardHolder are declared. These will be used to store the user's input and the corresponding cardHolder object, respectively.

The program then enters an infinite loop, which will continue until a valid card number is entered. Inside the loop, the program attempts to read a line of input from the console, which is expected to be the user's card number. It then tries to find a cardHolder in the cardHolders list whose cardNum matches the entered card number using the FirstOrDefault method. If a match is found, the corresponding cardHolder object is assigned to currentUser and the loop is broken. If no match is found, an error message is printed and the loop continues.

If an exception occurs during this process (for example, if the user's input cannot be read), the program catches the exception and prints an error message, then continues with the next iteration of the loop.

After a valid card number has been entered, the program prompts the user to enter their pin. It then initializes a variable userPin to store this pin, and enters another infinite loop, presumably to validate the pin in a similar manner to the card number. However, the code for this part of the process is not shown in the provided excerpt.

my_atm_csharp's People

Contributors

braianperez97 avatar

Watchers

 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.