Welcome! Log In Create A New Profile

Advanced

Assignment 2

Posted by basicgerm 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Re: Assignment 2
March 29, 2010 10:10AM
Krish, you are missing a t in IntToStr
Re: Assignment 2
March 29, 2010 03:25PM
Hi,

Can anyone tell me what is wrong with my code for 2.7?? Any suggestions?

procedure TfrmBuyTickets.btnAddNamesClick(Sender: TObject);
const
MaxStadiums = 5;
var
StadiumName: String;
begin

if lstStadiums.Items.Count < MaxStadiums then
StadiumName := InputBox('FIFA Stadiums', 'Please enter the name of the stadium',''winking smiley;
lstStadiums.items.Add(StadiumName);

else if lststadiums.Items.Count = MaxStadiums then
MESSAGEDLG('Please enter a maximum of 5 stadiums',mtWarning,[mbOK],0);
btnAddNames.Enabled := false;
end;
avatar Re: Assignment 2
March 29, 2010 07:25PM
43437478 Wrote:
-------------------------------------------------------
> Hi,
>
> Can anyone tell me what is wrong with my code for
> 2.7?? Any suggestions?
>
> procedure TfrmBuyTickets.btnAddNamesClick(Sender:
> TObject);
> const
> MaxStadiums = 5;
> var
> StadiumName: String;
> begin
>
> if lstStadiums.Items.Count < MaxStadiums then
> StadiumName := InputBox('FIFA Stadiums', 'Please
> enter the name of the stadium',''winking smiley;
> lstStadiums.items.Add(StadiumName);


Good, but rather drop the else statement


> else if lststadiums.Items.Count = MaxStadiums
> then
> MESSAGEDLG('Please enter a maximum of 5
> stadiums',mtWarning,,0);
> btnAddNames.Enabled := false;
> end;



instead do another:

if lststadiums.Items.Count >= MaxStadiums
then
btnAddNames.Enabled := false;
end;


You are only checking when a new stadium is added, you still need to do this but you also need to check after a stadium has been added.

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
avatar Re: Assignment 2
March 29, 2010 10:33PM
43437478

There are also compound statements at the if .. then clauses.
This must be enclosed with begin .. end [no semicolon if you have the else part]
Re: Assignment 2
March 30, 2010 12:23AM
Thanks guys!
avatar Re: Assignment 2
April 01, 2010 12:44PM
avatar Re: Assignment 2
April 01, 2010 01:26PM
?> ?
avatar Re: Assignment 2
April 01, 2010 03:57PM
people I need to be spoonfed Question 2.8.

Language: Delphi
procedure TfrmBuyTickets.btnBuyForClick(Sender: TObject); var Count, Price, ListStadium : integer; Stadium, ListStadiumPrice : String; begin lstCost.Clear; Randomize; Stadium := lstStadiums.Items.GetText; ListStadium := lstStadiums.ItemIndex +1; ListStadiumPrice := (Stadium + '; stadium tickets costs '; + ';R '; + FloatToStr(Random(0 - 499)) + ';.00';); for ListStadium := 0 to 4 do lstCost.Items.Add(ListStadiumPrice); end;

How do i get it to list the stadium only once? and to give a number between 0 and 499 as a currency? freaking hell man, I can't loose this marks.
help please
avatar Re: Assignment 2
April 01, 2010 04:22PM
You should look up the stadium in the for loop, not before, as this will always show the same name.
Stadium := lstStadiums.Items[ListStadium];

Random(500); will give a random number from 0 to 499.

The upper bound of the for loop can be set by lstStadiums.Count, because maybe the code will change to have a different amount in the list box.
Re: Assignment 2
April 01, 2010 08:51PM
Hi Guys,

I was just about to submit my assigment, but look over it again, and was wondering if for Q2.8 it
is meant to be Cost := Random(500) + 1; OR Cost := Random(500) + 0; ?
We need to get a number between 0 and 499

How do you determine this?
Re: Assignment 2
April 01, 2010 08:56PM
Nevermind, I'm being dumb.
Obviously - Random(500) + 0

Good luck all!
My brain is mush after ICT2621.....................
avatar Re: Assignment 2
April 01, 2010 09:35PM
trying to submit assignment, met by this:

OraOLEDB error '80040e14'

ORA-01654: unable to extend index VOSDATAP.ISOLGEN2 by 8192 in tablespace WEBIDX

/SACDL20/INCs/AddLog.inc, line 92 
avatar Re: Assignment 2
April 01, 2010 09:39PM
did you get to submit yours fine? I think the DB crashed at myunisa because accessing last year's data gives errors too.
I;m not talking academic results. Getting the exam results of May/June 2009 produces an error. So it looks like I cant write or read to the DB of myunisa. Do they not have an after-hour DBA? damnit!
Re: Assignment 2
April 01, 2010 10:49PM
wtf is up with the assignments page on MyUnisa - Gives an error!
Is anyone else experiencing this?
Re: Assignment 2
April 01, 2010 10:50PM
What happens if midnight comes, and it still doesn't allow us to submit the required assignments?
avatar Re: Assignment 2
April 01, 2010 11:14PM
the my friend, i'm afraid, We're screwed.
Re: Assignment 2
April 01, 2010 11:16PM
Wonderful!
Sorry, only registered users may post in this forum.

Click here to login