Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 10th, 2006, 1:41 AM   #1
absentmindedjwc
Newbie
 
Join Date: Feb 2006
Location: Near Chicago
Posts: 5
Rep Power: 0 absentmindedjwc is on a distinguished road
Smile Need help on a simple 'ATM' project

I am trying to make a simple ATM C# app that will allow a user to enter a id, the program looks up the current balance, asks how much he wants to take out, chacks it with whats available, and then despences the money.

I just need a bit of help in starting out.... as I am rather new at this. Thanks
absentmindedjwc is offline   Reply With Quote
Old Feb 10th, 2006, 7:31 AM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Window app or console? How are the balances stored, in a file or database? Have you tried any code, if so what errors are you getting?
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Feb 10th, 2006, 7:44 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Your description is a fair start at defining your problem and generating pseudo-code to accomplish it. Flesh it out a tad, translate it into code, give it a shot, and post back with problems.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 10th, 2006, 1:28 PM   #4
absentmindedjwc
Newbie
 
Join Date: Feb 2006
Location: Near Chicago
Posts: 5
Rep Power: 0 absentmindedjwc is on a distinguished road
Quote:
Originally Posted by Infinite Recursion
Window app or console? How are the balances stored, in a file or database? Have you tried any code, if so what errors are you getting?
Console, balances are stored in the file, I have not tried any code yet, I am just asking for something to get me started.

As stated above, I am rather new at this (only second term in school, first term was a visual structure class, this one is C#) I understand how it should be organized, but I am not quite sure how to go about this one
absentmindedjwc is offline   Reply With Quote
Old Feb 10th, 2006, 2:16 PM   #5
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Alright... I was feeling nice... This code shows you how to read the balance from a file and I included a basic TODO list... it should get you started, the rest is up to you. Post back with specific problems...

using System;
using System.IO;
 
namespace atm
{
	class Class1
	{
		const string DATAFILE = "balance.txt";
 
		[STAThread]
		static void Main(string[] args)
		{
			double myBal = GetBalance(DATAFILE);
			Console.WriteLine("My balance is: {0}",myBal);
 
			//TODO: Prompt user for action, withdrawl or deposit... obtain amount.
			// 1) Withdrawal or Deposit?
			// 2) How much?
 
			 //TODO: Deposit:
			// 1) Call GetBalance, assign the returned value to a variable.
			// 2) Add the user defined amount to the current balance.
			// 3) Set balance in DATAFILE (create a SetBalance method (write to file)).
 
			//TODO: Withdrawal:
			// 1) Call GetBalance, assign the returned value to a variable.
			// 2) Check to see if sufficient funds are available.
			// 3) If funds available, subtract from available balance.
			// 4) Set balance in DATAFILE (create a SetBalance method (write to file)).
 
		}
 
		static double GetBalance(string DATAFILE)
		{
			StreamReader SR;
			string data;
			double balance = 0.0;
 
			SR=File.OpenText(DATAFILE);
			data=SR.ReadLine();
			SR.Close();
 
			balance = Convert.ToDouble(data);
			return balance;
		}
 
	}
}
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."

Last edited by Infinite Recursion; Feb 10th, 2006 at 2:43 PM.
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC