• 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

    Zip ,[vend_phone] as Phone ,[vend_fax] as Fax from [vendor] insert insert into [vendor] (vend_name,vend_cfname,vend_clname, vend_address1,vend_address2,vend_city,vend_state,vend_zip,vend_phone,vend_fax) values (@nme,@fname,@lname,@add1,@add2,@city,@state,@zip,@phone,@fax) @nme @fname @lname @add1 @add2 @city @state @zip @phone @fax update update [vendor] set vend_name=@nme,vend_cfname=@fname, vend_clname=@lname, vend_address1=@add1,vend_address2=@add2,vend_city=@city,vend_state=@state,vend_zip=@zip,vend_phone=@phone,vend_fax=@fax where [vend_id]=@vid @nme @fname @lname @add1 @add2 @city @state @zip @phone @fax @vid Rental items Select

  2. AS ICT Corsework - Mr Brookes K-Fit Ltd

    basket How I am going to test this: I am going to go through the buttons and check that they are linked correctly to the right page and frame. I tried to click the add to basket button and it displayed an error message due to a problem with an unsafe operation.

  1. ICT Sample Work India Red

    All of his staff are competent users of computers, so this is not a problem. Sachin, John and Ivan are the other users of the solutions. 6. What hardware and software do you have at The India Red? In terms of hardware, The India Red has only just brought four computers.

  2. Basic Database Building

    Facilities Member ID Long Integer 4 AllowZeroLength: False Attributes: Fixed Size CollatingOrder: General ColumnHidden: False ColumnOrder: Default ColumnWidth: Default DataUpdatable: False DecimalPlaces: Auto DisplayControl: Text Box OrdinalPosition: 1 Required: False SourceField: Member ID SourceTable: Facilities Member Name Text 50 AllowZeroLength: True Attributes: Variable Length CollatingOrder: General ColumnHidden: False ColumnOrder: Default

  1. Spare Parts Database Project

    Wong; Yes, as my profit increases, I will increase their salary, so as to retain them in my business. 15. Self: How much did you invest in the business? Mr. Wong; I invested about Rs 100000 in the business.

  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. 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

  2. Logue's Homer, War Music &amp;quot;The theme of respect for the warrior code&amp;quot;

    It is his use of the patronymic "Laomedon's son"(96) which emphasizes the significance of ancestry, a feature of the warrior code. Menelaos then states that "only [Priam] is King enough to make / Certain that Ilium keeps what Ilium gives"(96/97) and continues that "only [Priam], the Lord of Holy Troy, / Adding his voice to ours, can turn those

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