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

No comments:

Post a Comment