Wednesday, September 5, 2012

6/9 programming


yellow = what I have completed in plan 
green problems and changes 

Read array method (input an index output the content of the index as a string)  saves having to repeat the code that reads from the main array 
Declare string named result; set this to the array content at the index of the method input
Return result


Invalid input method (void only) this method is used to undo any results from and invalid input and set up the program for the hopefully correct next input
Show message box saying “invalid input; restart program”
if use read array “main” method (send name constant)= default;  the name constant wasn’t global
and I  couldn’t find its decleration ,A constant called deliverCost had value of one so I used it instead. Another change I had to set a local string to the return from the method, as it didn’t work inside the conditional statement. Another problem the comparison uses a string and a number. So I had to change it so it compares the name content to null. This still didn’t work, I tried changing the comparison to not equal instead and it fixed the error. But no I have to reverse the action the statement commands.


run setup method restarts the program so the user can try to enter the input correctly.
else; clear pizza choice textbox and set pizza number to pizza number minus default This will undo the recording of the invalid pizza choice
I have a feeling this is wrong as default is a string content of “0”, I assume I forgot to say to convert to a int; but the value still seams incorrect. At this point I will assume the value is meant to be minusing one off the tracker of how many pizza choices have been entered,  as said in my original comment. For this value of one I will use the deliverCost constant.       

No comments:

Post a Comment