• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

Program Code Program DVD_Program; Uses Menuunit, CRT, dos; {Declaration of constants in program}

Extracts from this document...

Introduction

Program Code Program DVD_Program; Uses Menuunit, CRT, dos; {Declaration of constants in program} CONST Never= False; mem_mainfile= 'c:\ripmid.rec'; vid_mainfile= 'c:\ripvid.rec'; rentalfile= 'c:\ripren.rec'; yesno: array [boolean] of string = ('No', 'Yes'); {Declaration of data type} TYPE mem_rec= record mid: longint: mname: string; address: string; phone: string; end; mem_file= file of mem_rec; video_rec=record vid: longint; vname: string; actor: string; genre: string; cost: real; stock_number: integer; end; video_file= file of video_rec; rental_rec= record mid: longint; vid: longint; datedue: string; dateborrowed: datetime; days: longint; returned: boolean; {--------------------------------------------------------------------} {Declaration of variables} VAR member: mem_file; one_rec: mem_rec; found: Boolean; epos: integer; password: text; video: video_file; two_rec: video_rec; foundb: Boolean; eposb: integer; {--------------------------------------------------------------------} {Ensures that the member names input by users are valid i.e. all characters are letters} Function validatemname (mname: string): integer; VAR j, l: integer; c: char; valid: integer; Begin l:= length (mname); valid:= 0; FOR j:= 1 to 1 DO Begin If not (mname[j] in ['A'..'Z','a'..'z','-',' ']) then valid:= j; End; validatemname:= valid; If (valid<> 0) then Begin textcolor (red); gotoxy (12,19); Write( 'SORRY INVALID NAME '); delay (800); textcolor(blue); gotoxy (37,13); For j:= 1 to 1+1 Do Write (' '); End; End; {--------------------------------------------------------------------} {Ensures that the video name input by users are valid i.e. characters, numbers, spaces and dashes only} Function validatevname (vname: string) : integer; VAR j, l: integer; c: char; valid: integer; Begin l:= length (vname); valid:= 0; FOR j:= 1 to 1 DO Begin If not (vname[j] in ['A'..'Z','a'..'z','-',' ','0'..'9']) then valid:= j; End; validatevname:= valid; If (valid<> 0) then Begin textcolor (red); gotoxy (12,19); Write( 'SORRY INVALID NAME '); delay (800); textcolor(blue); gotoxy (37,13); For j:= 1 to 1+1 Do Write (' '); End; End; {--------------------------------------------------------------------} {Ensures that the address entered by the user is acceptable or valid i.e. containing only letters and numbers.} Function validateaddress (address: string): integer; VAR j, l: integer; c: char; valid: integer; Begin l:= length (address); valid:= 0; FOR j:= 1 to 1 DO Begin If not (address[j] in ['A'..'Z','a'..'z'..,'#','0'..'9']) ...read more.

Middle

Close (member); Restore_Screen; Window (1, 2, 80, 24); {Since Draw_Shadow_Box messes up window settings it has to be reset} End; {--------------------------------------------------------------------} {This procedure is used to view all video records stored in the database.} Procedure view_all_video; VAR i, size: integer; Begin Assign (video,' c:\pas.video\pas'); Reset (video); size:= filesize (video); For i:= 1 to size Do Begin Clear_Selected; Save_Screen; Draw_Shadow_Box (10, 9, 70, 20); TextColor (15); Gotoxy (12, 10); Write ( 'View all video records...'); Gotoxy (12, 11); TextColor (red); Write (' ---------------------------'); Read (video, two_rec); display_video (two_rec) Gotoxy (12, 19); TextColor (blue); Write ('Press Enter to continue or Esc to exit...'); ch:= Readkey; If ch= #27 then i:= size; End; Close (video); Restore_Screen; Window (1, 2, 80, 24); {Since Draw_Shadow_Box messes up window settings it has to be reset} End; {--------------------------------------------------------------------} {This procedure is used to edit a member record stored in the database.} Procedure do_edit_member; VAR one_rec: mem_rec; an_id: integer; Begin Gotoxy (12, 18); Write ('Please enter the field to edit (1-3) '); Gotoxy (12, 17); Write ('1- ');textColor (red+ blink); write ('Name '); textcolor (blue); Write ('2- ');textColor (red+ blink); write ('Address '); textcolor (blue); Write ('3- ');textColor (red+ blink); write ('Phone # '); textcolor (blue); ch:= readkey; case ch of '1' Repeat Gotoxy (12, 19); Write ('Please enter member name: '); Readln (one_rec.mname); Until ( validatemname (one_rec.mname)=0); '2' Repeat Gotoxy (12, 19); Write ('Please enter address: '); Readln (one_rec.address); Until ( validateaddress (one_rec.address)=0); '3' Repeat Gotoxy (12, 19); Write ('Please enter phone #: '); Readln (one_rec.phone); Until ( validatephone (one_rec.phone)=0); End; {End of repeat loop} Seek (member, epos-1); Write (member, one_rec); End; {--------------------------------------------------------------------} {This procedure is used to edit a member record stored in the database.} Procedure edit_member; VAR mid: longint; Begin Clear_Selected; Save_Screen; Draw_Shadow_Box (7, 8, 70, 23); TextColor (15); Gotoxy (12, 10); Write ( 'Edit a member record...'); Gotoxy (12, 11); TextColor (red); Write (' ---------------------------'); TextColor (blue); Gotoxy (12, 12); Write (' Enter the id# of member record to modify: '); Read (mid); search_for_member (one_rec, mid); If (found) ...read more.

Conclusion

('Press Enter to try again'); Readkey; End; Until (valid); End; {--------------------------------------------------------------------} {This procedure is allows user to select options from the menu.} Procedure menu_selection; Begin Repeat Init_Screen; Init_Menus; {Set menu colours.} C_MenuBack:= 8; C_MenuText:= 2; C_HighBack:= 12; C_HighText:= 16; Bottom_Bar ('F10 = Activate menu. Select exit on the file menu to quit'); Create_Menu (1, 1, 79); ch:= #0; Window (1, 2, 80, 24); If key pressed then ch:= readkey; If ch= #0 then Begin ch:= readkey; If ch= #68 then {F10 pressed} Window (1, 1, 80, 25); Start_Menu_Sys; Window (1, 2, 80, 24); End; {Check what was selected from the menu} If selected (1, 2) then init_file; If selected (1, 4) then add_a_member; If selected (1, 5) then add_a_video; If selected (1, 7) then locate_member_record; If selected (1, 8) then locate_video_record; If selected (1, 10) then view_all_member; If selected (1, 11) then view_all_video; If Selected (3, 6) then Exit: Begin Clear_Selected; TextMode (co80); TextBackGround (0); goodbye; End; If selected (2, 2) then edit_member; If selected (2, 3) then edit_video; If selected (2, 5) then delete_member; If selected (2, 6) then delete_video; If selected (3, 1) then Rental_record; If selected (3, 2) then do_borrow; If selected (3, 3) then do_return; If selected (3, 4) then count_movies_out; If selected (3, 5) then search_member_rental; If selected (4, 1) then set_password; Until never; End; {--------------------------------------------------------------------} {This procedure sets the password.} Procedure pass_word; VAR apass, pass: string; valid: boolean; i: integer; ch: string; Begin valid:= false; Assign (password, 'c:\pas\passw.pas'); Reset (password); Read (password, pass); Close (password); Repeat Init_screen; Clear_Selected; Save_Screen; Draw_Shadow_Box (10, 9, 70, 16); TextColor (15); Gotoxy (12, 10); Write ('Please enter password'); ch:="; apass:="; i:= 35; Repeat apass:= apass+ ch; ch:= readkey; Gotoxy (i, 10); inc (i); Write ('*'); Until (ch= #13); Gotoxy (12, 12); TextColor (red+ blink); If (apass= pass) then valid:= true; Else Begin Write ('Sorry invalid password'); Gotoxy (12, 14); Write (' Press enter to try again'); Readkey; End; Until (valid); End; {--------------------------------------------------------------------} {This is the main program.} Begin welcome; pass_word; menu_selection; goodbye; End. ...read more.

The above preview is unformatted text

This student written piece of work is one of many that can be found in our AS and A Level Computer Science section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related AS and A Level Computer Science essays

  1. Video Rental System

    The dependencies before normalization First Normal Form: CUS_ID - (CUS_ADDRESS, CUS_PHONE, CUS_NAME) ITEM_ID - ( ITEM_SHORT_DESC,ITEM_NAME) CUS_ID+ITEM_ID - (CUS_ADDRESS, CUS_PHONE, CUS_NAME, ITEM_RENT_PRICE, ITEM_NAME, RENTAL_DATE, RENTAL_DUE_DATE) Second Normal form: CUS_ID - (CUS_ADDRESS, CUS_PHONE, CUS_NAME) ITEM_ID - ( ITEM_SHORT_DESC,ITEM_NAME) CUS_ID + ITEM_ID - (RENTAL_DATE, RENTAL_DUE_DATE)

  2. ICT Sample Work India Red

    * Search which allows the entered data to be automatically displayed, which will reduce time looking for previous orders and stops the user from flicking between screen. * Automatically calculate and display information in specific fields below to reduce data input therefore reducing time and also mistakes.

  1. Basic Database Building

    16 May 2008 Table: MemberDetails Page: 9 DataUpdatable: False DecimalPlaces: Auto Description: Age of the member DisplayControl: Text Box GUID: {guid {C6EC3D95-3FC0-437C-805F-FCA5B168883F}} OrdinalPosition: 2 Required: False SourceField: Age SourceTable: MemberDetails Telephone Number Long Integer 4 AllowZeroLength: False Attributes: Fixed Size CollatingOrder: General ColumnHidden: False ColumnOrder: Default ColumnWidth: Default DataUpdatable: False

  2. Spare Parts Database Project

    Customer ID Customer name, Address, letters ID Report File 1.6 Constraints and limitations System boundaries (scope of proposed system) The system to be developed is a customer information system, and is intended to enhance rather than replace the current system of recording item and customers records.

  1. Business blue print document for the implementation of SAP R/3 (4.6B) payroll at Mastek ...

    The payday is the last working day of the month. The chart attached herewith will make the wage type understanding more clearly. The wage types shown in this chart are the wage types used by Mastek. Handling of various scenarios through Payroll - India Hiring (Taking place other than first of the month)

  2. Write a TOM program that reads a number from the keyboard, subtracts 1 and ...

    store location display with the value 0 in it total data 0 Initialises a store location total with the value 0 in it 3. Write a TOM program that displays two numbers, entered from the keyboard, in descending numerical order.

  1. What is transaction processing?

    Disadvantages As technology has progressed so have the different types of crime. There is an increase of internet fraud and malicious hacking taking place within the world today and these could all have a diverse effect on transactional processing. Different methods have been developed in regards to accessing personal information

  2. Setting up a database for a shop selling P.C.'s.

    the component size and price. - Can use spell checker and grammar to check if letters or words are spelt correctly to make instructions of computers for users as easy as possible to prevent misunderstanding and any mix-ups from occurring. - Shortcut keys/macros can be used to avoid RSI and repetitive typing - If a

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work