小弟刚学Delphi语言,遇到两个程序题,那位高手帮忙解答一下,不胜感激!
题一 
 _____date; _____  type  TDate  =  _____    
Public
  Function getYear():integer;
  Function getMonth():integer;

Private
  …
Protected
  …
_____  ImplementationFunction TDateTime.getYear():integer;
Begin;
_____ :=2008;
End;
题二
Unit unit1;Interface
  Uses ………..;
  TForm1 = Class(TForm)
Public
  …
Private
  …
Protected
  Procedure drawIt(canvas:TCanvas);
  Procedure paint;  _____   ;
  Procedure print;
End;
 _____ form1:TForm1;Implementationprocedure TForm1.drawIt(canvas:TCanvas);
begin
  …
end;procedure TForm1.paint;
begin
  …
end;procedure print;
begin
  printer. _____  ;
  drawIt(  _____  );
  printer.  _____  ;
end;
 …
end.
 就是空白的地方需要补填起来,是作业题,帮帮忙!

解决方案 »

  1.   

      unit_____date;  interface_____type     TDate     =   class  _____
    Public
        Function   getYear():integer;
        Function   getMonth():integer;

    Private
        …
    Protected
        …
    end;_____ImplementationFunction   TDateTime.getYear():integer;
    Begin;
    Result _____   :=2008;
    End;
    题二
    Unit   unit1;Interface
        Uses   ………..;
        TForm1   =   Class(TForm)
    Public
        …
    Private
        …
    Protected
        Procedure   drawIt(canvas:TCanvas);
        Procedure   paint;     override_____       ;
        Procedure   print;
    End;
      var _____   form1:TForm1;Implementationprocedure   TForm1.drawIt(canvas:TCanvas);
    begin
        …
    end;procedure   TForm1.paint;
    begin
        …
    end;procedure   print;
    begin
        printer.   _____     ;
        drawIt(     _____     );
        printer.     _____     ;
    end;
      …
    end.
      

  2.   

    unit date; interfacetype           TDate           =       class
    Public 
            Function       getYear():integer; 
            Function       getMonth():integer; 
    … 
    Private 
            … 
    Protected 
            … 
    end;Implementation Function       TDateTime.getYear():integer; 
    Begin; 
    Result        :=2008; 
    End; 
    题二 
    Unit       unit1; Interface 
            Uses       ………..; 
            TForm1       =       Class(TForm) 
    Public 
            … 
    Private 
            … 
    Protected 
            Procedure       drawIt(canvas:TCanvas); 
            Procedure       paint;           override; 
            Procedure       print; 
    End; 
        var         form1:TForm1; Implementation procedure       TForm1.drawIt(canvas:TCanvas); 
    begin 
            … 
    end; procedure       TForm1.paint; 
    begin 
            … 
    end; procedure       print; 
    begin 
            printer.      begindoc; 
            drawIt(       form1           ); 
            printer.      enddoc; 
    end; 
        … 
    end.
      

  3.   

    procedure               print;   
    begin   
                    printer.             begindoc;   
                    drawIt(               printer                      );   
                    printer.             enddoc;   
    end;   
            …   
    end.
      

  4.   

    呵呵,楼主,新建一个Delphi项目就可以看得出来了啊。