🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.flame.pascal
Article #7

Re: help pascal basics

#7
From: 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
Technical Details
Message-ID: <851tio$8io$1@kruuna.Helsinki.FI>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <850k3u$q98$2@news8.svr.pol.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10eb32,c99eccfba7fc996
X-Google-Attributes: gid10eb32,public
X-Google-Thread: 108ebd,c99eccfba7fc996
X-Google-Attributes: gid108ebd,public
X-Google-Thread: 10c950,c99eccfba7fc996
X-Google-Attributes: gid10c950,public
X-Google-Thread: 111659,c99eccfba7fc996
X-Google-Attributes: gid111659,public
X-Google-Thread: 1043cf,c99eccfba7fc996
X-Google-Attributes: gid1043cf,public
From: ronkanen@cc.helsinki.fi (Osmo Ronkanen)
Subject: Re: help pascal basics
Date: 2000/01/06
Message-ID: <851tio$8io$1@kruuna.Helsinki.FI>
X-Deja-AN: 569048876
References: <850k3u$q98$2@news8.svr.pol.co.uk>
X-Complaints-To: usenet@news.helsinki.fi
X-Trace: oravannahka.helsinki.fi 947157401 8923 128.214.205.14 (6 Jan 2000 11:16:41 GMT)
Organization: University of Helsinki
NNTP-Posting-Date: 6 Jan 2000 11:16:41 GMT
Newsgroups: alt.flame.pascal,borland.public.delphi.objectpascal,borland.public.turbopascal,comp.lang.pascal.ansi-iso,comp.lang.pascal.borland