AtmApplication (2).cs - using System using System.IO using System.Linq namespace consoleproject.cs public class AtmFunction public int atmcalc(int opt

AtmApplication (2).cs - using System using System.IO using...

This preview shows page 1 - 2 out of 4 pages.

using System; using System.IO; using System.Linq; namespace consoleproject.cs { public class AtmFunction { public int atmcalc(int opt, int amt) //opt, and amt values are sent from the main program { int curr_bal=0; if (opt == 1) { // minus the amount to withdraw curr_bal = AtmApplication.bal - amt; } else if (opt == 2) { // add the amount to deposit curr_bal = AtmApplication.bal + amt; } else if (opt == 3) { // just display the balance curr_bal = AtmApplication.bal; } return curr_bal; //return the current (or) updated balance back to the main program } } public class AtmApplication { public static string user_pin; //set the user pin to login as public variable public static int bal; //set initial balance for our calculations public static int prev_bal; public static string acct; public static readonly string userFile = @"/Volumes/Srikanth Raju K/1 UOG/Computer Programming/userFile.txt"; public static readonly string txnFile = @"/Volumes/Srikanth Raju K/1 UOG/Computer Programming/transactions.txt"; public static void Main() //start of main program { var lines = File.ReadLines(userFile).Count(); var usr = File.ReadAllLines(userFile).Skip(lines - 1); foreach (string outfile in usr) { string[] output = outfile.Split(','); //taking the split text into array user_pin = output[0]; bal = Int32.Parse(output[1]); prev_bal = bal; acct = output[2]; // Console.Write(outfile + "\n");
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 4 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