• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

Algorithms - Error Checking HOW? (1 Viewer)

Ghost1788

Member
Joined
Jan 30, 2005
Messages
276
Location
Sydney
Gender
Male
HSC
2005
Ok I just been doing question 22 of the 2001 HSC and i'm trying part a) iii)
refer to attackments


Now how do I write the error checking component of this question.

This is all I’ve got so far


my answer so far said:
BEGIN UPDATE INVENTFILE
RowNumber = 1
Read STOCK(RowNumber, StkNumber, StkQuantity)
WHILE StkNumber <> “999”
Inventfile.stocknumber(stkNumber)
Inventfile.QuantityAvail = Inventfile.QuantityAvail + StkQuantity
RowNumber = RowNumber + 1
Read STOCK(RowNumber, StkNumber, StkQuantity)
ENDWHILE​

END UPDATE INVENTFILE

BEGIN STOCK(RowNumber, StkNumber, StkQuantity)
StkNumber = Transfile.stknumber(RowNumber)
StkQuantity = Transfile.stknumber(RowNumber)​
END STOCK
Its not finished but can you people tell me if this is right. Also can you tell me how to right the error-checking component for this question.

PS if i am wrong how do you answer this question in pseudocode
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
first thing I do is look out for obvious errors such as misspelling for variables, dodgy control structures, but if you analyse heaps of algorithms eventually you pick out things to look out for such as undeclared variables, logical use of control structures etc... sorry I couldnt really read that entire thing yet, I'l lwork on it tommorow :)
 

Ghost1788

Member
Joined
Jan 30, 2005
Messages
276
Location
Sydney
Gender
Male
HSC
2005
c'mon ppl surely there is someone ot ther who knows how to do this question
 
Joined
Jun 11, 2004
Messages
62
Gender
Male
HSC
2005
I'll have a look if I get some spare time, although with trials I don't think there is much time for that.
 

D43V1L0N3

New Member
Joined
Aug 16, 2005
Messages
14
Location
canberra
Gender
Male
HSC
2005
for the error detecting bit just tac something like this after

Inventfile.QuantityAvail = Inventfile.QuantityAvail + StkQuantity

IF inventfile.quantityAvail <= 3 THEN
PRINT There are only "& inventfile.quantity & " of stock number " & inventfile.stocknumber & " in stock.
END IF
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
IF inventfile.quantityavail < 3 THEN
^^ it asks for less than 3, not 3 or less, i know its nit picking, but even in a flawless algorithm they'll minus a mark for that little equals sign
 

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

Top