🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.flame.pascal
6 messages
6 total messages Started by chris millar Wed, 05 Jan 2000 00:00
help pascal basics
#11
Author: chris millar
Date: Wed, 05 Jan 2000 00:00
18 lines
1636 bytes
Hi I am a college student and I deparately need urgent help on pascal
programming.

I need to develop a simple program that can keep a video store booking
system running.  I have chosen my data fields as Date of loan/return, what
film(i.d number) and what time due back.
I want to implement this using a 3 dimensional array, with a simple
interface for the users.  I need to use file accessing methods too.  Can
anyone steer me in the right direction or help me out.

Thanks in advance.

chris..
chipmonk497@hotmail.com
please reply to my mail address, anyone

Thanks again
.
Re: help pascal basics
#6
Author: Seak, Teng-Fong
Date: Thu, 06 Jan 2000 00:00
16 lines
1704 bytes
     Hmm, in a database, I would have expected a chained record, ie with the
use of pointers, for the sack of sorting and data expansion. Otherwise one has
to provide a very large table to map every individual record.  Anyway, dynamic
dbase is always better than static dbase.

Osmo Ronkanen wrote:

> How about:
> type timerecord=record
>                   year:word;
>                   case boolean of
>                     false: (min,hour,day,month:byte);
>                     true:  (compfield:longint);
>                   End
>                 End;
> [etc]
Re: help pascal basics
#7
Author: Osmo Ronkanen
Date: Thu, 06 Jan 2000 00:00
84 lines
4372 bytes
In article <850k3u$q98$2@news8.svr.pol.co.uk>,
chris millar <cm497@ecs.soton.ac.uk> wrote:
>Hi I am a college student and I deparately need urgent help on pascal
>programming.
>
>I need to develop a simple program that can keep a video store booking
>system running.  I have chosen my data fields as Date of loan/return, what
>film(i.d number) and what time due back.

How about: 
type timerecord=record
                  year:word;
                  case boolean of 
                    false: (min,hour,day,month:byte);
                    true:  (compfield:longint);
                  End
                End; 
 

Type Casrecord=record
                 Title: string[60];
                 renttime:Timerecord
                 duetime:Timerecord;
                 CustomerNumber:longint;
               End;

Alternatively you could also pack the time in longints either as
bitfields or using linear time.
     
Then you probably want to keep record of Customers:

     Customerrecord=record
                      name:string[40];
                      Address:string;
                      balance:longint;
                      extrainfo:string;
                    End;
   
Now for a more practical solution one should break movies and
cassettes, as stores can hold several copies of a single movie and
storing the name for each copy would be take unnecessary space. Also it
would make easier to answer the question: are there copies of this and
that movie.

Type MovieRecord=record
                   Title:string;
                   copies: word;
                   copiesLeft:word;
                 End;

     Cassetterecord=Record
                      MovieNro:word;
                      renttime:timerecord;
                      duetime:timerecord;
                      CustomerNumber:longint;
                    End;

                        
Also the system should store all (or at least latest past loans). In a
practical system security is key thing so it would be good if there was
immediate paper output for each event

>I want to implement this using a 3 dimensional array, with a simple
>interface for the users.  I need to use file accessing methods too.  Can
>anyone steer me in the right direction or help me out.

3D array???? You may need four arrays: like

Movies, cassettes, customers and past loans (store cassette record and
return time+relevant info the user told about the condition of the tape.
Now it is questionable whether one should actually store all these in
arrays in memory. Especially customer info is best to keep only at disk.
(the record of a single customer is accessed so rarely). Well one might
normally keep all on disk and only for special operations, like
searching a free movie on title read them in memory. Keeping all on disk
also makes things more secure. Repeated accesses are optimized by disk
caches (flushing the disk cache after loan/return is worth a bonus point). 
The disk based approach also gets rid of all those 64KB limits.The disk
files should of course be sorted or have sorted indexes as sequential
search is way too slow. For customers you need two ways to access: name
(or ssn) and customer number. (The user may not remember his customer
number, or that may be totally internal to the system)

Osmo
Re: help pascal basics
#8
Author: The Scarlet Manuka
Date: Thu, 06 Jan 2000 00:00
28 lines
2259 bytes
In comp.lang.pascal.borland, chris millar <cm497@ecs.soton.ac.uk> wrote:

> system running.  I have chosen my data fields as Date of loan/return, what
> film(i.d number) and what time due back.
> I want to implement this using a 3 dimensional array, with a simple

Why on earth do you want a 3-dimensional array for this?

Also, don't you think it would be a good idea to store some information
about *who* has a given video on loan?

Your data fields are not going to be of the same type. Therefore the basic
data structure should not be an array but a record. You may have an array of
such records, or simply store them in a file.

Details of file accessing methods can be found in your manual or textbook.
They are quite simple.


-- 
______________________________________________________________________
     The Scarlet Manuka,      |        Nitpickers' Party motto:
  Pratchett Quoter At Large,  |  "He who guards his lips guards his
 First Prophet of Bonni, is:  |  soul, but he who speaks rashly will 
   sacha@maths.uwa.edu.au     |    come to ruin." -- Proverbs 13:3
______________________________|_______________________________________
*All opinions in this article are fictional.  Any resemblance to real
opinions, whether living or dead, is purely coincidental.*
Re: help pascal basics
#9
Author: Maynard Philbrook
Date: Thu, 06 Jan 2000 00:00
52 lines
2349 bytes
If it's going to be a simple project for a class then you can use simple block
file system.
type
    datarecord = record
        name:String[255];
        date:string[8];
        time:string[8];
       VideoTitle:string[64];
     end;
Var
  F:file of datarecord;
 R:DataRecord;
procedure addRec;
begin
  Seek(F, FileSize(F));
  write(F, R);
End;
begin
  AssignFile(F, 'databasename');
  Reset(F);
{$I-} // turn off io checking..
  read(F, R); // Read first record;
  if ioerror Then Rewrite(F); // if error then create data file for the first
time..
// edit your record ect////
 CloseFile(F);
Endl
 this is just a rough draft..




chris millar wrote:

> Hi I am a college student and I deparately need urgent help on pascal
> programming.
>
> I need to develop a simple program that can keep a video store booking
> system running.  I have chosen my data fields as Date of loan/return, what
> film(i.d number) and what time due back.
> I want to implement this using a 3 dimensional array, with a simple
> interface for the users.  I need to use file accessing methods too.  Can
> anyone steer me in the right direction or help me out.
>
> Thanks in advance.
>
> chris..
> chipmonk497@hotmail.com
> please reply to my mail address, anyone
>
> Thanks again
> .
Re: help pascal basics
#10
Author: The Scarlet Manuka
Date: Thu, 06 Jan 2000 00:00
17 lines
1863 bytes
In comp.lang.pascal.borland, Maynard Philbrook <jamie@cyberzone.net> wrote:
> {$I-} // turn off io checking..
>   read(F, R); // Read first record;
>   if ioerror Then Rewrite(F); // if error then create data file for the first
> time..

Don't forget to turn it back on again with {$I+}, unless you're planning to
write a bunch of I/O error handling procedures (which, for a basic
assignment like this, would almost certainly be unwarranted).

-- 
______________________________________________________________________
     The Scarlet Manuka,      |        Nitpickers' Party motto:
  Pratchett Quoter At Large,  |  "He who guards his lips guards his
 First Prophet of Bonni, is:  |  soul, but he who speaks rashly will 
   sacha@maths.uwa.edu.au     |    come to ruin." -- Proverbs 13:3
______________________________|_______________________________________
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads