home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP_ADV.ZIP / LIST0913.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-11-17  |  4.5 KB  |  158 lines

  1. Program Video;
  2.  
  3. Uses
  4.   CRT,
  5.   EditTool,
  6.   WindTool;
  7.  
  8. Const
  9.   MaxMovies = 5;  { Maximum movies a customer can check out }
  10.  
  11. Type
  12.   MovieType = Array [1..MaxMovies] of Word;
  13.   CustRec = Record
  14.               Name : String [ 30 ];
  15.               Address1,
  16.               Address2 : String [ 50 ];
  17.               City : String [ 20 ];
  18.               Phone : String [ 14 ];
  19.               Movies : MovieType;
  20.             End;
  21.  
  22. Var
  23.   cust : CustRec;
  24.  
  25. Procedure DisplayQuestions;
  26. { Display the questions about the customer on the screen and }
  27. { blank the fields for input.                                }
  28. Begin
  29.   GotoXY ( 2, 2 );
  30.   Write ( 'Customer Name:' );
  31.   GotoXY ( 2, 4 );
  32.   Write ( 'Address (line1):' );
  33.   GotoXY ( 2, 6 );
  34.   Write ( 'Address (line2):' );
  35.   GotoXY ( 2, 8 );
  36.   Write ( 'City:' );
  37.   GotoXY ( 2, 10 );
  38.   Write ( 'Phone Number: ' );
  39.  
  40.   BlankXY ( 20,  2, 30 );
  41.   BlankXY ( 20,  4, 50 );
  42.   BlankXY ( 20,  6, 50 );
  43.   BlankXY ( 20,  8, 20 );
  44.   BlankXY ( 20, 10, 14 );
  45. End;
  46.  
  47. Procedure GetCustInfo;
  48. { Get the information from the keyboard pertaining to the customer }
  49. Begin
  50.   cust.Name     := ReadString ( 20,  2, 30 );
  51.   cust.Address1 := ReadString ( 20,  4, 50 );
  52.   cust.Address2 := ReadString ( 20,  6, 50 );
  53.   cust.City     := ReadString ( 20,  8, 20 );
  54.   filter := ['(',')','-','0'..'9']; { set filter for phone type chars }
  55.   cust.Phone    := ReadString ( 20, 10, 14 );
  56.   ResetFilter;
  57. End;
  58.  
  59. Procedure GetCustomer;
  60. { Procedure to control the window and inputing of information regarding }
  61. { the customer.                                                         }
  62. Begin
  63.   OpenWindow ( 1, 1, 80, 13, 3, (Cyan shl 8) + Blue, 'Customer Address' );
  64.   DisplayQuestions;
  65.   GetCustInfo;
  66.   CloseWindow;
  67. End;
  68.  
  69. Procedure DisplayMovieTitles;
  70. { Procedure to display the available movie selections }
  71. Begin
  72.   WriteLn ( '1. Movie Title', '11. Movie Title':30, '21. Movie Title':30 );
  73.   WriteLn ( '2. Movie Title', '12. Movie Title':30, '22. Movie Title':30 );
  74.   WriteLn ( '3. Movie Title', '13. Movie Title':30, '23. Movie Title':30 );
  75.   WriteLn ( '4. Movie Title', '14. Movie Title':30, '24. Movie Title':30 );
  76.   WriteLn ( '5. Movie Title', '15. Movie Title':30, '25. Movie Title':30 );
  77.   WriteLn ( '6. Movie Title', '16. Movie Title':30, '26. Movie Title':30 );
  78.   WriteLn ( '7. Movie Title', '17. Movie Title':30, '27. Movie Title':30 );
  79.   WriteLn ( '8. Movie Title', '18. Movie Title':30, '28. Movie Title':30 );
  80.   Write   ( '9. Movie Title', '19. Movie Title':30, '29. Movie Title':30 );
  81. End;
  82.  
  83. Procedure DisplayMovieQuestions;
  84. { Procedure to display questions regarding movie choices and to }
  85. { blank the input fields.                                       }
  86. Begin
  87.   WriteLn ( 'Choice 1:' );
  88.   WriteLn ( 'Choice 2:' );
  89.   WriteLn ( 'Choice 3:' );
  90.   WriteLn ( 'Choice 4:' );
  91.   Write   ( 'Choice 5:' );
  92.  
  93.   BlankXY ( 11, 1, 5 );
  94.   BlankXY ( 11, 2, 5 );
  95.   BlankXY ( 11, 3, 5 );
  96.   BlankXY ( 11, 4, 5 );
  97.   BlankXY ( 11, 5, 5 );
  98. End;
  99.  
  100. Procedure GetMovieQuestions;
  101. { Procedure to get the movie choices from the keyboard }
  102. Var
  103.   code,
  104.   loop : Integer;
  105. Begin
  106.   filter := ['0'..'9'];  { filter only numeric characters }
  107.   For loop := 1 to 5 Do
  108.     Val ( ReadString ( 11, loop, 5 ), cust.Movies[ loop ], code );
  109.   ResetFilter;
  110. End;
  111.  
  112. Procedure GetMovie;
  113. { Procedure to manipulate the windows and control input for }
  114. { getting movie choices.                                    }
  115. Var
  116.   storeAttr : Word;  { variable to save screen colors }
  117. Begin
  118.   OpenWindow ( 1, 1, 80, 11, 2, (Blue shl 8) + Yellow, 'Movie Titles' );
  119.   storeAttr := TextAttr;
  120.   TextBackground ( Cyan );
  121.   TextColor ( 6 );
  122.   ClrScr;
  123.   DisplayMovieTitles;
  124.  
  125.   OpenWindow ( 1, 13, 80, 19, 2, (Cyan shl 8) + Blue, 'Customer''s Movies' );
  126.   DisplayMovieQuestions;
  127.   GetMovieQuestions;
  128.   CloseWindow;
  129.  
  130.   CloseWindow;
  131.   TextAttr := storeAttr;
  132. End;
  133.  
  134. Procedure CheckOut;
  135. { Report to screen the information received on the customer and }
  136. { movie selections.                                             }
  137. Begin
  138.   ClrScr;
  139.   WriteLn ( cust.Name, ' who lives at:' );
  140.   WriteLn ( '    ', cust.Address1 );
  141.   WriteLn ( '    ', cust.Address2 );
  142.   WriteLn ( '    ', cust.City );
  143.   WriteLn ( 'has checked out the following movies numbers:' );
  144.   WriteLn ( cust.Movies[1], ', ', cust.Movies[2], ', ', cust.Movies[3], ', ',
  145.             cust.Movies[4], ', ',cust.Movies[5], '.' );
  146.   WriteLn;
  147.   WriteLn ( 'The customer''s phone number is ',cust.Phone, '.' );
  148. End;
  149.  
  150. Begin
  151.   TextColor ( LightGray );
  152.   TextBackground ( Black );
  153.   ClrScr;
  154.   GetCustomer;
  155.   GetMovie;
  156.   CheckOut;
  157. End.
  158.