home *** CD-ROM | disk | FTP | other *** search
- Program Video;
-
- Uses
- CRT,
- EditTool,
- WindTool;
-
- Const
- MaxMovies = 5; { Maximum movies a customer can check out }
-
- Type
- MovieType = Array [1..MaxMovies] of Word;
- CustRec = Record
- Name : String [ 30 ];
- Address1,
- Address2 : String [ 50 ];
- City : String [ 20 ];
- Phone : String [ 14 ];
- Movies : MovieType;
- End;
-
- Var
- cust : CustRec;
-
- Procedure DisplayQuestions;
- { Display the questions about the customer on the screen and }
- { blank the fields for input. }
- Begin
- GotoXY ( 2, 2 );
- Write ( 'Customer Name:' );
- GotoXY ( 2, 4 );
- Write ( 'Address (line1):' );
- GotoXY ( 2, 6 );
- Write ( 'Address (line2):' );
- GotoXY ( 2, 8 );
- Write ( 'City:' );
- GotoXY ( 2, 10 );
- Write ( 'Phone Number: ' );
-
- BlankXY ( 20, 2, 30 );
- BlankXY ( 20, 4, 50 );
- BlankXY ( 20, 6, 50 );
- BlankXY ( 20, 8, 20 );
- BlankXY ( 20, 10, 14 );
- End;
-
- Procedure GetCustInfo;
- { Get the information from the keyboard pertaining to the customer }
- Begin
- cust.Name := ReadString ( 20, 2, 30 );
- cust.Address1 := ReadString ( 20, 4, 50 );
- cust.Address2 := ReadString ( 20, 6, 50 );
- cust.City := ReadString ( 20, 8, 20 );
- filter := ['(',')','-','0'..'9']; { set filter for phone type chars }
- cust.Phone := ReadString ( 20, 10, 14 );
- ResetFilter;
- End;
-
- Procedure GetCustomer;
- { Procedure to control the window and inputing of information regarding }
- { the customer. }
- Begin
- OpenWindow ( 1, 1, 80, 13, 3, (Cyan shl 8) + Blue, 'Customer Address' );
- DisplayQuestions;
- GetCustInfo;
- CloseWindow;
- End;
-
- Procedure DisplayMovieTitles;
- { Procedure to display the available movie selections }
- Begin
- WriteLn ( '1. Movie Title', '11. Movie Title':30, '21. Movie Title':30 );
- WriteLn ( '2. Movie Title', '12. Movie Title':30, '22. Movie Title':30 );
- WriteLn ( '3. Movie Title', '13. Movie Title':30, '23. Movie Title':30 );
- WriteLn ( '4. Movie Title', '14. Movie Title':30, '24. Movie Title':30 );
- WriteLn ( '5. Movie Title', '15. Movie Title':30, '25. Movie Title':30 );
- WriteLn ( '6. Movie Title', '16. Movie Title':30, '26. Movie Title':30 );
- WriteLn ( '7. Movie Title', '17. Movie Title':30, '27. Movie Title':30 );
- WriteLn ( '8. Movie Title', '18. Movie Title':30, '28. Movie Title':30 );
- Write ( '9. Movie Title', '19. Movie Title':30, '29. Movie Title':30 );
- End;
-
- Procedure DisplayMovieQuestions;
- { Procedure to display questions regarding movie choices and to }
- { blank the input fields. }
- Begin
- WriteLn ( 'Choice 1:' );
- WriteLn ( 'Choice 2:' );
- WriteLn ( 'Choice 3:' );
- WriteLn ( 'Choice 4:' );
- Write ( 'Choice 5:' );
-
- BlankXY ( 11, 1, 5 );
- BlankXY ( 11, 2, 5 );
- BlankXY ( 11, 3, 5 );
- BlankXY ( 11, 4, 5 );
- BlankXY ( 11, 5, 5 );
- End;
-
- Procedure GetMovieQuestions;
- { Procedure to get the movie choices from the keyboard }
- Var
- code,
- loop : Integer;
- Begin
- filter := ['0'..'9']; { filter only numeric characters }
- For loop := 1 to 5 Do
- Val ( ReadString ( 11, loop, 5 ), cust.Movies[ loop ], code );
- ResetFilter;
- End;
-
- Procedure GetMovie;
- { Procedure to manipulate the windows and control input for }
- { getting movie choices. }
- Var
- storeAttr : Word; { variable to save screen colors }
- Begin
- OpenWindow ( 1, 1, 80, 11, 2, (Blue shl 8) + Yellow, 'Movie Titles' );
- storeAttr := TextAttr;
- TextBackground ( Cyan );
- TextColor ( 6 );
- ClrScr;
- DisplayMovieTitles;
-
- OpenWindow ( 1, 13, 80, 19, 2, (Cyan shl 8) + Blue, 'Customer''s Movies' );
- DisplayMovieQuestions;
- GetMovieQuestions;
- CloseWindow;
-
- CloseWindow;
- TextAttr := storeAttr;
- End;
-
- Procedure CheckOut;
- { Report to screen the information received on the customer and }
- { movie selections. }
- Begin
- ClrScr;
- WriteLn ( cust.Name, ' who lives at:' );
- WriteLn ( ' ', cust.Address1 );
- WriteLn ( ' ', cust.Address2 );
- WriteLn ( ' ', cust.City );
- WriteLn ( 'has checked out the following movies numbers:' );
- WriteLn ( cust.Movies[1], ', ', cust.Movies[2], ', ', cust.Movies[3], ', ',
- cust.Movies[4], ', ',cust.Movies[5], '.' );
- WriteLn;
- WriteLn ( 'The customer''s phone number is ',cust.Phone, '.' );
- End;
-
- Begin
- TextColor ( LightGray );
- TextBackground ( Black );
- ClrScr;
- GetCustomer;
- GetMovie;
- CheckOut;
- End.
-