Tuesday, September 25, 2012

26



Problem with confirming order with no number in the box goes into another double popup problem, because the method has to return the text. I fixed this by adding another Boolean and an if statement of the code in the button click to check there is text in the text box
Doing some testing with message boxes my main array doesn’t contain anything, there must be a problem with the writing or it is over written

The string for the final display doesn’t clear for the next input, I fixed this by clearing the string before it is written to.

Monday, September 24, 2012

25


The invalid input checking comes up when it isn’t meant to, in not delivery mode.
I think I may be clearing the text box before I read it some how ?
Need line break at the end of the detail method
The delivery cost is somehow set to the content of the name textbox
Pizzas 4-9 are shown when they aren’t meant to, there is no total cost.

What I still need to do

Testing throughout  whole process
I need to fix one more double popup problem
I need to fix the displaying of the final order, its possibiliy something todo with the calculations.
Then I need to comment t he rest of my code

Sunday, September 23, 2012

24/9

I fixed the extra popup of the detail summery. It was caused because the invalid input was triggered in a returning method, so when it restarts for new input, it still has to return something to run; so the popup forces the user to restart the program again to get to the start. I fixed this by adding a Boolean to track if this problem is going to happen, this also meant I had to move and add other variables. Within this I also fixed the error checking, it was looking at the array for a invalid input but the starting values I added for other reasons stopped the detection. So I switched the check to the text boxes.

Working on check to see if there is a number in the name

Wednesday, September 19, 2012

20/9


When in pick-up mode; click confirm details button without inputting anything
Invalid input
Same error as other order type.
I just realizes the possibility that the dialog box pop-up if statement may not work at the start if it doesn’t work for the confirming of the order. I put in an additional pop to check if code was running, but it didn’t run when it was meant to. The conditional statement is the following;
 “DialogResult == System.Windows.Forms.DialogResult.Yes”
I then started playing around changing it to
(DialogResult != System.Windows.Forms.DialogResult.No)
And that ran the code?
 I did set the right message box to dialog result; this fixed the problem

After going through the program, I realised that the final order message wasn’t running because, you need to be entering your final pizza code when you click it. To make this more user friendly; I will add a check to see it the textbox is empty first.

19/9


It only goes to the invalid input method. I looked at the code and removed the part that restarts the program, in relation to the confirm details button and I removed the trigger. Although the invalid didn’t run the method that was meant to didn’t; this must mean my if statements comparison is wrong. 
I then switched the statement to check the condition of the second stage. It came up with a unhandled format exception. I forgot the syntax “.text” for reading from a textbox
                                                                               
Note; there is no need to check the customer detail details for formats and size exceptions. This is because even if the user doesn’t type the ideal input, it can’t break the program no matter what. As the input is only going to be collected and displayed. If the brief required more user guidance, I would have had to add a checking system. 
After completing entering and confirming customer details; put a letter in pizza choice textbox and click next
Invalid input should appear in a message and after exiting that message it will be as if the user didn’t enter the invalid piece of information
There was no handling of this exception. For some reason I put the line of code just above the try catch, I moved it down to fix the problem.
But after that I noticed that when the program prepared for a new order, the last input in the pizza choice text box was still there. So I added code to clear it on the start=up method.
 Doing this I also noticed the progress counter was one out. It starts at one then it change to one without an extra space. Setting the variable to one by default fixed this.

During the above I noticed that the menu doubled up after the program is restarted a few times.Because this has to be written on the first time but not after, I clear the label every reset. Another option could have been a counter and if statement.  

I noticed that after the max amount of pizzas has been entered the text box disables but the next button doesn’t

Monday, September 17, 2012

18/9


Testing Plan

Exceptions

Try to input into the pizza choice textbox before the customer details have been confirmed
Nothing

Try to click the next button before the customer details have been confirmed
Nothing

Try to click the confirm order button before the customer details have been confirmed
Nothing

Try to click the confirm details button order button before the customer details have been confirmed
Unhandled format exception; where there is the check to see if the phone number is a number. It seems I forgot to add the try catch statement over it. This stopped the exception, but when the program is re-started on the invalid message; it brings up the starting message and then the summary of the details entered, which is nothing. Once you continue pressing yes or no to the details; the program restarts, and works like before the error. I think the confirm detail button may have something causing it to engage once the program re-starts after the error initially. To try and fix this I will disable the button and reengage it when its needed. Disabling the button the button on the invalid message method didn’t change anything.
A message saying either invalid input or the summary of the customer details
After above; if there is an invalid input when you click ok or you click no to confirming the customer details; the program will reset. But if all is correct and you click yes to the customer details; the details textboxes and confirm button will disable as the next button confirm order button and pizza choice textbox is enabled.   

Try to input into the name textbox before the customer details have been confirmed
The text will appear

Try to input into the address textbox before the customer details have been confirmed
The text will appear

Try to input into the phone textbox before the customer details have been confirmed
The text will appear

Start program and chose any order type (pick up/ delivery)
The pizza menu should look like the following;
0: Pineapple $8.50                                                                                                                                                               1: Cheesy $8.50                                                                                                                                                                                    2: Bacon $8.50                                                                                                                                                                          3: Apricot $8.50                                                                                                                                                                      4: Ham $8.50                                                                                                                                                                               5: All in one $13.50                                                                                                                                                                        6: Double Cheese $13.50                                                                                                                                               7: Chicken supreme $13.50                                                                                                                                                8: Seafood $13.50                                                                                                                                                      9: Mexican fiesta $13.50
With the program full running I found that this test failed. This problem was immediately tracked to the use of my line break syntax. I used “</br>”; then I changed all the line breaks to the other syntax I know, “\r\n”; this resolved that problem. But there was still one other difference; the first line said defult 0: Pineapple $8.50, this was the part in the label on  the form, I removed this.

17/9


Run start up method
On “confirm button” click
 Show message box with the following;   return from “customer detail” method, line break and the text “Do you want to continue?(yes) Or start again(no)”, show yes and no buttons
If the user clicked yes use” stage two” method.
If the user clicks no; use “start-up” method
On “Next” button click
Use “Pizza choice” method The processes of this button is in a method because the same thing needs to happen when the confirm button is pressed
On “Confirm order” button
Use “Pizza choice” method
Message box show the following;
Return from “customer detail” method, line break this will show all of the details the user has entered in to the program
Return from “order detail” method, line break
“Do you want to submit (yes)? Or restart (no)”
Use buttons yes and no
Run start-up method  to pretend to send the information and move onto the next order and try to enter the order again 

With no errors my program still didn't run

Wednesday, September 12, 2012

13/11 programming

I fixed the syntax for the conditional statement from the message box.


Pizza order read method (input of the code of the pizza choice) used to find the name and price of a pizza code and to update the total cost
Start looking for exceptions
Declare string named pizza set this to the content of the menu array from the index inputted (read directly) 
Declare constant double called deluxe set as 13.5 local
Declare constant double called standard set as 8.5 local
Declare variable double new Cost local
Declare constant inerter “deluxe Comparison” local
in the above it seems again I have forgotten to say what the constant is meant to be set to. I looked up the indexes for the pizzas in the menu array, the index 5 is the first deluxe pizza. So I set deluxe comparison to 5 because, this is a distinction between the two pizza costs.
If the index input is between “default”- deluxe Comparison; set pizza cost to standard, otherwise set it to deluxe this is used to calculate the final total by determining the cost of the current pizza being read
If any format of size exceptions found; run invalid input
Return “pizza”
Customer order method (returns a string) compiles a string to display as the final summary
For loop; a now declared counter variable set at “four” until its at the derived value of the array length add one each time the loop runs this loop displays all of the content of the main array, while converting the pizza codes to their number and names   
Loop start;
Declare string all order used to store the details into one string
Declare integer index set to the return from; Use array main read method, send counter variable, 
Declare string order set it to the following; counter variable converted to a string, the return from using pizza array read(sending index) and a line break.
Array write, send total and use array main read (send total) converted to a double plus the pizza cost that as a total is then converted back to a string (this is a global variable)  this creates the total
Add order to the end of all order. End of loop
Add the following to the end all over; “delivery:  $” plus the return from using array read main (sending delivery cost)
In above the text piece needs a space at the end
Return all over

Tuesday, September 11, 2012

9/12 Programming


The following checks to see if the user did input the details 
If; the return of the delivery cost array index is equal to “address” and if use read array “main” method (send name constant) = default or:” use read array method(send Address constant) = default  or use read array method(send Phone constant)= default . Here I forgot to mention what the index value is for delivery cost, this is 0; so I will use the defult constant converted to an int. The above is just used to check if input has been recorded, so I have “null” because no text doesn’t equal 0.
Then use invalid input method
if use read array “main” method (send name constant)= default 
Then use invalid input method
The two lines of code above are not needed as I combined a check for the non-delivery input into the other check
The following compiles the summary to display
Declare string called “customer detail” and set to the following; local
 “Name:” use read array method(send name constant) line break
“Address:” use read array method(send Address constant) line break
“Phone:” use read array method(send Phone constant) line break
Return customer detail this sends  the string to the caller of the method

11/9 programming


I remembered more of the message box button syntax 

If pizza code; bigger than “total” or smaller than “default”. Then run invalid input
Wasn’t sure if the next two lines are part of the if statement above, I put it in the statement
 Use array main write method; send pizza number +”four”& pizza code converted to string
Declare constant inerter “max Pizzas” local  I haven’t assigned a number here so I think it must relate to the next line of code, so it could be 8 or 5. 5 is the max number of pizzas, 8 is it’s index. I don’t think the variable is related to the array so I assume it is meant to be set to 5; but it’s possible it could be set at 4, if 0 is counted.
If pizza number is equal or bigger than “max Pizzas”; set pizza number to “default”(0) disable pizza choice this will show that the user has reached the max pizzas and will prepare the form for the next loop
Clear pizza choice textbox reads the text box for more input; only needed when next clicked, even though it isn’t needed when the confirm order button is clicked
Set pizza choice label to; “Pizza number” and pizza + one (using++) number converted to a string this will show the user how many pizzas have already been entered ( by default when the program first opens the label will read Pizza choice number one I assumed that when I said “and pizza + one”, I meant to say pizza number pluss one.
If any format or size exceptions found run invalid input method
Stage two method (no input/outputs) sets the form so the user can’t change the customer details accidently when entering the order and can put in the pizzas  
Disable name textbox
Disable address textbox
Disable phone textbox
Disable confirm detail button
Enable pizza choice textbox
Enable next button
Enable confirm order button
Customer detail method(no input returns string)  shows the user the details of the customer to check them before continuing
Declare integer constant name as 1 local to this method
Use array write method (send name and content of name textbox) stores the details in array
Use array write method (send address and content of address textbox) stores the details in array
Use array write method (send phone and content of phone textbox that is converted to a number and then back into a string) stores the details in array

Sunday, September 9, 2012

Programming 10/9


Pizza choice this process is in a method because the same function is needed in two places; to record the pizza choice 
Add one to pizza number this will keep track of how many pizzas have been entered
Start looking for exceptions
Declare integer pizza code and set it to content of pizza choice converted to a number this is used to check the input is a number; if it isn’t there will be a format exception local
If pizza code; bigger than “total” or smaller than “default”. Then run invalid input
Wasn’t sure if the next two lines are part of the if statement above
 Use array main write method; send pizza number +”four”& pizza code converted to string
Declare constant inerter “max Pizzas” local  I left this as a variable because I haven’t said a value to give it

Use array write send “counter variable” and “default”, end of loop.
Show message box asking “Is the order delivery” with yes and no buttons did remember syntax need to find my example code
If the user clicks yes; array write send; “default” and “phone” the name phone is because the constant value of 3 is also used as the index for the address; this will add the delivery cost and keep track of the order type

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.       

Tuesday, September 4, 2012

Day three

Today ( only partial lesson), I started to setup my first method.

I found a problem; C# won't let me call a void (method without argument or return specifically), at the start of the program.

I must improve the start-up method so it return something, or the my program structure will fail. I also don't remember how to use the enable and clear syntax, or its possabiliy


Monday, September 3, 2012

Programming day one

On the first day I set up my form layout and assigned all of the components names.

I didn't have a copy of my original plans screen layout, so I found it difficult to setup.

Take a digital copy of my layout.