AtmApplication (1).cs - using System namespace consoleproject.cs public class AtmFunction public int atmcalc(int opt int amt int curr_bal=0 if(opt = 1

AtmApplication (1).cs - using System namespace...

This preview shows page 1 - 3 out of 3 pages.

using System; namespace consoleproject.cs { public class AtmFunction { public int atmcalc(int opt, int amt) { int curr_bal=0; if (opt == 1) { curr_bal = AtmApplication.bal - amt; } else if (opt == 2) { curr_bal = AtmApplication.bal + amt; } else if (opt == 3) { curr_bal = AtmApplication.bal; } return curr_bal; } } public class AtmApplication { public static string user_pin = "12345"; public static int bal=12320045; public static int prev_bal = bal; public static void Main() { atmpin: Console.Clear(); // string acct_num = "12345", acct; string pin = ""; string amt_wdraw; string amt_dep; char cont='n'; AtmFunction calc = new AtmFunction(); // Console.Write("Please Enter Your Account Number:"); // acct = Console.ReadLine(); Console.Write("Please Enter Your ATM Pin: "); ConsoleKeyInfo key; do { key = Console.ReadKey(true); if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter) { pin += key.KeyChar; Console.Write("*"); } else if(key.Key == ConsoleKey.Backspace) { if (pin.Length != 0) { Console.Write("\b"); pin = pin.Remove(pin.Length - 1, 1);
Image of page 1
} } } while (key.Key != ConsoleKey.Enter); Console.WriteLine(); if (AtmApplication.user_pin == pin) { Console.Write("\n"); Console.WriteLine("User Login Successful!\n");
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Spring '18
  • book

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors