home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog4 / hotdog.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.2 KB  |  56 lines

  1.                                    -- Chapter 25 - Program 1
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure HotDog is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    task Gourmet is
  11.       entry Make_A_Hot_Dog;
  12.    end Gourmet;
  13.  
  14.    task body Gourmet is
  15.    begin
  16.       Put_Line("I am ready to make a hot dog for you");
  17.       for Index in 1..4 loop
  18.          accept Make_A_Hot_Dog do
  19.             delay 0.8;
  20.             Put("Put hot dog in bun ");
  21.             Put_Line("and add mustard");
  22.          end Make_A_Hot_Dog;
  23.       end loop;
  24.       Put_Line("I am out of hot dogs");
  25.    end Gourmet;
  26.  
  27. begin
  28.    for Index in 1..4 loop
  29.       Gourmet.Make_A_Hot_Dog;
  30.       delay 0.1;
  31.       Put_Line("Eat the resulting hot dog");
  32.       New_Line;
  33.    end loop;
  34.    Put_Line("I am not hungry any longer");
  35. end HotDog;
  36.  
  37.  
  38. -- Result of execution
  39.  
  40. -- I am ready to make a hot dog for you
  41. -- Put hot dog in bun and add mustard
  42. -- Eat the resulting hot dog
  43. --
  44. -- Put hot dog in bun and add mustard
  45. -- Eat the resulting hot dog
  46. --
  47. -- Put hot dog in bun and add mustard
  48. -- Eat the resulting hot dog
  49. --
  50. -- Put hot dog in bun and add mustard
  51. -- I am out of hot dogs
  52. -- Eat the resulting hot dog
  53. --
  54. -- I am not hungry any longer
  55.  
  56.