unit Question2_UXXXX;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, StdCtrls, ComCtrls, uHouseCheckXXXX;

type
  TfrmQuest2 = class(TForm)
    MainMenu1: TMainMenu;
    OptionA1: TMenuItem;
    OptionB1: TMenuItem;
    OptionC1: TMenuItem;
    Quit1: TMenuItem;
    redOutput: TRichEdit;
    OptionD1: TMenuItem;
    procedure Quit1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure OptionA1Click(Sender: TObject);
    procedure OptionB1Click(Sender: TObject);
    procedure OptionC1Click(Sender: TObject);
    procedure OptionD1Click(Sender: TObject);private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmQuest2: TfrmQuest2;
  house : THouseCheckXXXX;

implementation

{$R *.dfm}

procedure TfrmQuest2.Quit1Click(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TfrmQuest2.FormActivate(Sender: TObject);
var
  iDays : integer;
  sServices : String;
begin
  iDays := StrToInt(InputBox('Input days', 'How many days will the client be away for?', ''));
  sServices := InputBox('Input services', 'Which services are required?', '');

  house := THouseCheckXXXX.Create(iDays, sServices);
end;

procedure TfrmQuest2.OptionA1Click(Sender: TObject);
begin
  redOutput.Lines.Clear;
  redOutput.Lines.Add('Day' + #9 + 'Services');
  redOutput.Lines.Add(house.toString);
end;

procedure TfrmQuest2.OptionB1Click(Sender: TObject);
begin
  redOutput.Lines.Clear;
  redOutput.Lines.Add('Total cost: '+ FloatToStrF(house.getTotalCost,ffCurrency,12,2));
  redOutput.Lines.Add('');
end;

procedure TfrmQuest2.OptionC1Click(Sender: TObject);
var
  d : integer;
begin
  d := StrToInt(InputBox('Input day', 'Enter the day you want to see the services for', ''));
  redOutput.Lines.Clear;
  redOutput.Lines.Add('Services required for day ' + IntToStr(d) + ' : ' + house.getServicesForDay(d));
end;

procedure TfrmQuest2.OptionD1Click(Sender: TObject);
var
  iMoreDays : integer;
begin
  redOutput.Lines.Clear;
  iMoreDays := StrToInt(InputBox('Input days', 'How many more days will the person be away?', ''));
  house.extendDays(iMoreDays);
end;

end.


