Recently recieved assignment (1 Viewer)

Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
Anyone get assignment on 'critically analyising' a 2 pages algorithm (split up into 5 subprograms and 1 mainprogram) in pseudocode, and be given the interface to proposed program its to be used by (there's more to the assignment but I doubt anyone has done it)

I'll scan it later for the curious
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
havent finished it yet :p, its due next friday, i only have the algorithm that needs to be corrected with some notes on it

i thought i might ask some questions here due to uncertainty of certain logical and syntax errors :p
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
here is a ballbuster

BEGIN SUBPROGRAM Enter Form Details
Set Index = 0
Set GuestCount = 0
Read GuestName, No_Of_Nights, No_Of_Guests, Hotel, Breakfast
WHILE GuestName NOT "ZZZZ"
Guest(Index).Name = GuestName
Guest(Index).Nights = No_of_Nights
Guest(Index).Number = No_of_Guests
Guest(Index).Hotel = Hotel
Guest(Index).BFast = Breakfast
GuestCount = GuestCount + Guest(Index).Number
Index = Index + 1
Read GuestName, No_Of_Nights, No_Of_Guests, Hotel, Breakfast
ENDWHILE
TotalRooms = Index
TotalGuests = GuestCount
END SUBPROGRAM Enter Form Details

GuestName, No_Of_Nights, No_Of_Guests are text boxes that can be inputted
Hotel is a radio button (case)
breakfast is a boolean variable

Now i need to 'critically analyse' this, I have already modified it from its original algorithm but the WHILE loop confuses me, basically this WHILE loop keeps going until there is ZZZZ, now nobody is going to enter ZZZZ for their last name and thats it, is there another way to logically tell it to keep repeating, i was thinking along the lines of WHILE NOT EOF, but Im really not sure, very confused, id really appreciate some help this assignment is due thursday D:
 
Last edited:

HellVeN

Banned
Joined
Jun 26, 2004
Messages
532
Gender
Male
HSC
2005
I've only had a quick glance at it but I'm pretty sure that "ZZZZ" is just like EOF - End of file, I think it's also know as a sentinel value (correct me if I'm wrong). The last value in the file would be "ZZZZ" and when the program encounters it it would understand that the it has finished reading the file.
The problem here is that whilst it is unlikely that someone has a name like "ZZZZZZZ" , it would still be better programming if the sentinal value "ZZZZ" was changed to something more appropriate like an alpha character which could not be anyone's name like "#" or something.

The sentinel value is the value at the end of the file which signifies that the file is finished. You could probably get away with what you said (while not eof - but explain that eof is a sentinel value etc...).

Hope I helped..
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
Thanks! the guys on hte #hsc channel explained it as well, i do understand what you mean, but that would mean that whoever is entering this has to know after their done entering someones details they need to enter "ZZZZ" to kill it so the program can initialise totalrooms and totalguests, and the rest of the subprograms can continue, but if i am "critically analysing" i guess i could say that
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005



sorry for asking so many questions, but its only small details im unsure of :p, and its due tommorow

anyways this is onyl a simple yes or no answer, you see how the hotel names listed (seaview etc..), well those 2 variables being initialised, roomcost and bfcost, the first 2 i want to fall under seaview, now, can a casewhere work like this? or do they need to be on the same line as seaview

thanks in advance!
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top