unit Question1_U;

//Enter your student number here

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, pngimage, ExtCtrls, Spin, ComCtrls, jpeg;

type
  TfrmQuestion1 = class(TForm)
    grpQ1_1: TGroupBox;
    grpQ1_2: TGroupBox;
    grpQ1_3: TGroupBox;
    btnQ1_1: TBitBtn;
    btnQ1_2_1: TBitBtn;
    btnQ1_3: TBitBtn;
    edtQ1_1: TEdit;
    spnQ1_1: TSpinEdit;
    Label1: TLabel;
    pnlQ1_1: TPanel;
    Label2: TLabel;
    Bevel1: TBevel;
    Img1: TImage;
    img2: TImage;
    img3: TImage;
    img4: TImage;
    img5: TImage;
    img6: TImage;
    img7: TImage;
    img8: TImage;
    img9: TImage;
    img10: TImage;
    img11: TImage;
    img12: TImage;
    img13: TImage;
    img14: TImage;
    btn1_2_2: TBitBtn;
    imgQ1_1: TImage;
    cmbQ1_3: TComboBox;
    Image1: TImage;
    Label3: TLabel;
    lbl_Vowels: TLabel;
    lbl_Consonants: TLabel;
    grpQ1_4: TGroupBox;
    lblQ1_3: TLabel;
    Bevel2: TBevel;
    imgQ1_3: TImage;
    btnQ1_4: TBitBtn;
    redQ1_3: TRichEdit;
    procedure btnQ1_1Click(Sender: TObject);
    procedure btnQ1_2_1Click(Sender: TObject);
    procedure btnQ1_3Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure btn1_2_2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnQ1_4Click(Sender: TObject);
  private
    { Private declarations }
  public
  iCard : Integer;
  Procedure DisplayCards;
  Procedure DisplaySingleCard(sLine:string);
    { Public declarations }
  end;

var
  frmQuestion1: TfrmQuestion1;
  arrNumber: array[1..14] of string;
  arrCards : array[0..14] of timage;

implementation

{$R *.dfm}

procedure TfrmQuestion1.btnQ1_1Click(Sender: TObject);
var idecks : integer;
   rcost, rvat: real;
const
  rPrice = 20;

begin
//Question 1.1.1



//Question 1.1.2



 //Question 1.1.3



end;

procedure TfrmQuestion1.btnQ1_2_1Click(Sender: TObject);
 var ipoint: integer;
begin
//Question 1.2.1




//Provided code
 DisplayCards;
end;

procedure TfrmQuestion1.btn1_2_2Click(Sender: TObject);
var
//Provided variables
tFile : textfile;
sLine:string;
i : integer;
begin
//Question 1.2.2




   //Provided code
    DisplaySingleCard(sLine);


end;

procedure TfrmQuestion1.btnQ1_3Click(Sender: TObject);
begin

//Question 1.3



end;

procedure TfrmQuestion1.btnQ1_4Click(Sender: TObject);
var
//Provided variables
  sCard  : string;   //sCard holds the number entered by the user
  itot, inum: integer;
  bcont : boolean;
begin
//Question 1.4
{ itot :=55;
  bcont := true;

 while (itot<=50  and bcont = true)do
   begin
   scard := (getInput('enter a number','','10'));
   inum := strtofloat(scard);
   itot := inc(itot,inum);
   sout := sout + inttostr(inum)+ ' + ';
   imgQ1_3.LoadFromFile(sCard+'.png');
   repaint;
   sleep(500);


   if not(inputbox('enter another card','Y/N','Y')[1]<> ['y','Y'])
   then bcont := false;
   end
    delete(sout,length(sout)-2,3);
   redQ1_3.Lines.Add(sout);
   if itot > 50
     then lblQ1_3.Caption := inttostr(itot) & ' Burst'
     else lblQ1_3.Caption := inttostr(itot);      }

end;





{$Region 'Code to manipulate pictures - do not change}
//Provided code - do NOT change
procedure TfrmQuestion1.FormCreate(Sender: TObject);

var
i ,icount: integer;
Control : tControl;

begin
  icount:= 0;
  for i := 0 to frmQuestion1.ComponentCount - 1 do
  begin
    if frmQuestion1.Components[i] is TImage then
    begin
      arrCards[icount] := TImage(frmQuestion1.Components[i]);
      Inc(icount);
    end;
  end;
end;

procedure TfrmQuestion1.FormActivate(Sender: TObject);
begin
 iCard := 0;
end;

procedure TfrmQuestion1.DisplayCards;
var
 I : integer;
begin
//Provided code
  for I := 1 to 14 do
 begin
    arrCards[i].Picture.LoadFromFile(inttostr(I)+ '.png');
 end;
end;

procedure TfrmQuestion1.DisplaySingleCard;

begin

if sline = ''  then
     sline := '3';

     inc(iCard);
     arrCards[iCard].Picture.LoadFromFile(sLine + '.png');
end;


 {$EndRegion}


end.
