Welcome! Log In Create A New Profile

Advanced

Assignment 3 Question 4.10 - 4.13.. ???

Posted by SkillS4eva 
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
Assignment 3 Question 4.10 - 4.13.. ???
April 13, 2007 12:09AM
In the code skeleton for 4.10 they have:

Procedure TfrmRainbow.btnSelectClick(Sender: TObject);
var
nTotal : Integer;
nCount : Integer;
nSelect : Integer;

begin


Now correct me if Im wrong but aren't those local variables?

If so:

1> How can nCount be reference in OnFormShow or OnFormCreate?

2> If nTotal is a running total where do you initialize its value to 0 and how can you clear it in the Reset procedure?

I can understand that nSelect is a local variable because its not needed anywhere else but I think the other 2, nCount and nTotal should be global variables...

Anyone have any ideas, thoughts or suggestions?

Thanks!
Anonymous User
Re: Assignment 3 Question 4.10 - 4.13.. ???
April 13, 2007 08:17AM
I haven't checked the book yet but Yes, they are all local variables.

nTotal can be initialised to zero just bolow begin.
nCount should be reference to OnFormShow since it displays the counted variables.
Re: Assignment 3 Question 4.10 - 4.13.. ???
April 13, 2007 12:27PM
Thanks for the reply.

Quote

nTotal can be initialised to zero just bolow begin.

If you initialize it just after begin every, time u click "Select a Colour" it will reset the nTotal's value to 0 so there will be no running total.

Quote

nCount should be reference to OnFormShow since it displays the counted variables.

How can you reference a local variable outside of the procedure call it was created in?
Re: Assignment 3 Question 4.10 - 4.13.. ???
April 30, 2007 09:53AM
Hi Skills4Eva,

Did you get Question 4.10 - 4.12 sorted yet on Assignment 3? I'm also struggling a bit with this one....

R
Re: Assignment 3 Question 4.10 - 4.13.. ???
April 30, 2007 11:40AM
Sorted and working!!

R
How to send assignment 3?
May 10, 2007 01:29PM
Could somebody tell me how to send assignment 3. What format?
Must it be a text document????
Re: Assignment 3 Question 4.10 - 4.13.. ???
May 13, 2007 10:40PM
Hi Whiza!
I am struggling a little with q 4.10 – 4.12. I will really appreciate if you could help me a bit.confused smiley
If you initialize ntotal just after begin, every (time u click "Select a Colour" it will reset the nTotal's value to 0 so there will be no running total. How to change it?
My program do change colour according to nSelect, but how to count how many times does any colour was selected.
hot smiley As you know we need to return this assignment by Tuesday and I tried everything and it still doesn’t want to work
Please give me a hint.
Sorry, only registered users may post in this forum.

Click here to login