Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
I need help with an ATM program!!! Posted by stooboy on 26 Apr 2005 at 4:35 AM
Help!!!!
Report
Re: I need help with an ATM program!!! Posted by Gaashius on 26 Apr 2005 at 4:46 AM
: Help!!!!
:
Would you be so kind as to tell us detailed information about what do you need, thanks

****************
Any questions? Just ask!

GAASHIUS


Report
Re: I need help with an ATM program!!! Posted by stooboy on 26 Apr 2005 at 4:57 AM
I need a template if poss
Report
Re: I need help with an ATM program!!! Posted by Gaashius on 26 Apr 2005 at 11:56 AM
Sorry, I would really like to help you, but my english is terrible(as you can see), and that ATM is a thing that I do not understand.

****************
Any questions? Just ask!

GAASHIUS


Report
Re: I need help with an ATM program!!! Posted by Phat Nat on 26 Apr 2005 at 5:52 PM
: Help!!!!
:

You need to be more specific. Obviously this is a school project, so you won't get much help if all you're willing to put in is "Help!!!!"

Tell what you need the program to do, what you have or where you are having problems. I'll give a general answer for a general question.

1) Create a loop
2) Ask for a choice
3) Process choice (call procedure) or "Finish Transaction"
4) Goto #1 until "Finish Transaction" is called

Good Luck,

Phat Nat

Report
Re: I need help with an ATM program!!! Posted by stooboy on 28 Apr 2005 at 1:21 AM
: : Help!!!!
: :
:
: You need to be more specific. Obviously this is a school project, so you won't get much help if all you're willing to put in is "Help!!!!"
:
: Tell what you need the program to do, what you have or where you are having problems. I'll give a general answer for a general question.
:
: 1) Create a loop
: 2) Ask for a choice
: 3) Process choice (call procedure) or "Finish Transaction"
: 4) Goto #1 until "Finish Transaction" is called
:
: Good Luck,
:
: Phat Nat
:
:

Report
Re: I need help with an ATM program!!! Posted by stooboy on 28 Apr 2005 at 1:22 AM
Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.

Stoo
Report
Re: I need help with an ATM program!!! Posted by zibadian on 28 Apr 2005 at 1:45 AM
: Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.
:
: Stoo
:
Yes. the easiest way to do this is to place a "pin code"-file on the floppy, and let the user press a key after he inserted the floppy. Sadly there is no way to detect if a floppy is entered, and then run a certain procedure.
Report
Re: I need help with an ATM program!!! Posted by Gaashius on 28 Apr 2005 at 5:37 AM
: : Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.
: :
: : Stoo
: :
: Yes. the easiest way to do this is to place a "pin code"-file on the floppy, and let the user press a key after he inserted the floppy. Sadly there is no way to detect if a floppy is entered, and then run a certain procedure.
:
Stooboy can detect floppy disks which act like a bank card. He needs to check if the PIN-file exists, if exists there is a valid floppy in the drive.

****************
Any questions? Just ask!

GAASHIUS


Report
Re: I need help with an ATM program!!! Posted by zibadian on 28 Apr 2005 at 10:53 AM
: : : Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.
: : :
: : : Stoo
: : :
: : Yes. the easiest way to do this is to place a "pin code"-file on the floppy, and let the user press a key after he inserted the floppy. Sadly there is no way to detect if a floppy is entered, and then run a certain procedure.
: :
: Stooboy can detect floppy disks which act like a bank card. He needs to check if the PIN-file exists, if exists there is a valid floppy in the drive.
:
: ****************
: Any questions? Just ask!
:
: GAASHIUS
:
:
:
You can use FileExists() to check if the file exists. Or if FileExists() isn't recognized by your compiler you can use the IOResult method, which is slightly more coding. The TP help files include a good example of the IOResult code.
Report
Re: I need help with an ATM program!!! Posted by Gaashius on 28 Apr 2005 at 1:15 PM
: : : : Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.
: : : :
: : : : Stoo
: : : :
: : : Yes. the easiest way to do this is to place a "pin code"-file on the floppy, and let the user press a key after he inserted the floppy. Sadly there is no way to detect if a floppy is entered, and then run a certain procedure.
: : :
: : Stooboy can detect floppy disks which act like a bank card. He needs to check if the PIN-file exists, if exists there is a valid floppy in the drive.
: :
: : ****************
: : Any questions? Just ask!
: :
: : GAASHIUS
: :
: :
: :
: You can use FileExists() to check if the file exists. Or if FileExists() isn't recognized by your compiler you can use the IOResult method, which is slightly more coding. The TP help files include a good example of the IOResult code.
:
Yes, pascal is not delphi there isn't any FileExists funcs. Here's one:
function fileexists(f:string):boolean;
var
 stream:file;
begin
 if f='' then begin
  exist := false;
  exit;
 end;
 assign(stream,f);
 {$i- }
 reset(stream);
 close(stream);
 {$i+ }
 fileexists:=(ioresult=0);
end;


****************
Any questions? Just ask!

GAASHIUS


Report
Re: I need help with an ATM program!!! Posted by zibadian on 28 Apr 2005 at 2:12 PM
: : : : : Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.
: : : : :
: : : : : Stoo
: : : : :
: : : : Yes. the easiest way to do this is to place a "pin code"-file on the floppy, and let the user press a key after he inserted the floppy. Sadly there is no way to detect if a floppy is entered, and then run a certain procedure.
: : : :
: : : Stooboy can detect floppy disks which act like a bank card. He needs to check if the PIN-file exists, if exists there is a valid floppy in the drive.
: : :
: : : ****************
: : : Any questions? Just ask!
: : :
: : : GAASHIUS
: : :
: : :
: : :
: : You can use FileExists() to check if the file exists. Or if FileExists() isn't recognized by your compiler you can use the IOResult method, which is slightly more coding. The TP help files include a good example of the IOResult code.
: :
: Yes, pascal is not delphi there isn't any FileExists funcs. Here's one:
:
: function fileexists(f:string):boolean;
: var
:  stream:file;
: begin
:  if f='' then begin
:   exist := false;
:   exit;
:  end;
:  assign(stream,f);
:  {$i- }
:  reset(stream);
:  close(stream);
:  {$i+ }
:  fileexists:=(ioresult=0);
: end;
: 

:
: ****************
: Any questions? Just ask!
:
: GAASHIUS
:
:
:
Some Pascal compilers do have FileExists(). Its been a while, but if I remember well, Freepascal does have it.
Report
Re: I need help with an ATM program!!! Posted by Phat Nat on 29 Apr 2005 at 12:25 AM
: : : Is there a way to use, say a floppy, as an actual bank card substitute. So that when you insert a floppy disk it acts as a bank card.
: : :
: : : Stoo
: : :
: : Yes. the easiest way to do this is to place a "pin code"-file on the floppy, and let the user press a key after he inserted the floppy. Sadly there is no way to detect if a floppy is entered, and then run a certain procedure.
: :
: Stooboy can detect floppy disks which act like a bank card. He needs to check if the PIN-file exists, if exists there is a valid floppy in the drive.
:
: ****************
: Any questions? Just ask!
:
: GAASHIUS

Or if you want added security, you could create/use a non-DOS/WINDOWS disk format so that the disk would be unreadable by DOS or Windows or just not show the bank pin info as a file. Also, you could then encode the data as well using an encryption based apon your PIN #.

Anyways, before any of this could be done, the program would need to be written.

Phat Nat

Report
Re: I need help with an ATM program!!! Posted by stooboy on 31 May 2005 at 2:31 AM
I'm wanting to create an account file that holds account information, eg:

on my atm program it is possible to create a new account. What I don't know is how do I keep adding new accounts to this file?

Stooboy
Report
Re: I need help with an ATM program!!! Posted by Phat Nat on 31 May 2005 at 5:35 PM
This message was edited by Phat Nat at 2005-5-31 17:36:12

: I'm wanting to create an account file that holds account information, eg:
:
: on my atm program it is possible to create a new account. What I don't know is how do I keep adding new accounts to this file?
:
: Stooboy
:

If your account is stored as a record variable, it is quite easy. You can write the record to a file and then use the Append() procedure to add on to a file if done in Text mode or Reset() if done in File Mode (preferable). The only problem you'll have is if you need to delete a record, but even this is quite easy.

You can either have an array of your records or just one and read records from the file one-by-one until you find the one you want. The second way allows a huge size of records without trying to use pointers, etc.

If you want to delete a record the second method, you would have to copy your data file to another temp file, then copy it back over the original one record at a time and just don't copy the record you want to delete. Then delete the Temp file.

TYPE
    MyRecord = record
       Name : String;
       Age  : Byte;
       {...}
    END;
VAR
   F    : File;
   Data : MyRecord;
   X    : Byte;

Begin
     Assign(F,'MYFILE.DAT'); {$I-}
     Reset(F,1);
     If IOResult <> 0 Then Rewrite(F,1);
     X := 0;
     While Not(Eof(F)) Do
     Begin
          Inc(X);
          BlockRead(F,MyRecord,SizeOf(MyRecord));
          WriteLn('Record #',X);
          WriteLn('  * Name = ',Data.Name);
          WriteLn('  * Age  = ',Data.Age);
          WriteLn;
          While Keypressed Do Readkey;
          Readkey;
     End;
     
     WriteLn('Enter Data:');
     Write('Name = ');
     ReadLn(Data.Name);
     If Data.Name <> '' then
     Begin
          WriteLn('Age  = ');
          ReadLn(Data.Age);
          Seek(F,FileSize(F));
          BlockWrite(F,MyRecord,SizeOf(MyRecord));
     End;
End.


Here's an example of storing & Reading records to a file.

Phat Nat


Report
Re: I need help with an ATM program!!! Posted by stooboy on 1 Jun 2005 at 4:00 AM
Thanks for your help doll!

I want to have a menu that offers users the chance to create a new account or enter their pin number, the latter taking them to withdraw,etc.

I have created a record to store information such as pin number , current balance.

I just don't understand how to store users details to file and keep adding to this file as more and more accounts are created, if you know what i mean.

Stooboy
Report
Re: I need help with an ATM program!!! Posted by Phat Nat on 1 Jun 2005 at 5:39 PM
: I just don't understand how to store users details to file and keep adding to this file as more and more accounts are created, if you know what i mean.

I must not understand. The program that I just posted does exactly this. It doesn't look for a record that is already there, but does allow for records to be added. Just run it a few times and you'll see. Each time you run it and add a name, it adds it to the end of the other names after displaying the ones that already exist. This could be easily modified to alphabetize them or check to see if the record already exists.

The only thing with storing records to file is that you can't change what info is stored to file after the file is started. so if you are going to need more than just name & pin (such as balance, etc), you need to take that into account now or build in an automatic data updater that uses File Versions.

Phat Nat




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.