<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:12.0pt;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:987827337;
        mso-list-type:hybrid;
        mso-list-template-ids:-248489658 201916431 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:1705594019;
        mso-list-type:hybrid;
        mso-list-template-ids:-924258466 -1110797990 201916419 201916421 201916417 201916419 201916421 201916417 201916419 201916421;}
@list l1:level1
        {mso-level-start-at:312;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:Arial;}
@list l1:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">To delete an item from an array, I find the simplest way is as follows.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo3"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Search for the item and record the index of that item in the array, say found_index<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo3"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">2.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Overwrite the item at found_index with the last item in the array. IE order(found_index) = order(num_items). Assume num_items is the number of items on the order array<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo3"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">3.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Reduce num_items by 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<br>
<style>
.ExternalClass * {line-height: 15px}
</style>
<table class="MsoNormalTable" style="WIDTH: 605px; HEIGHT: 116px; mso-cellspacing: 0cm; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 0cm 0cm 0cm" cellspacing="0" cellpadding="0" width="605" border="0">
<tbody>
<tr style="HEIGHT: 61.8pt; mso-yfti-irow: 2; mso-yfti-lastrow: yes">
<td style="BORDER-RIGHT: #d4d0c8; PADDING-RIGHT: 0cm; BORDER-TOP: #d4d0c8; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; WIDTH: 138px; LINE-HEIGHT: 15px; PADDING-TOP: 0cm; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" valign="top" width="113" height="116">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><b style="mso-bidi-font-weight: normal"><span style="FONT-SIZE: 10pt; LINE-HEIGHT: 15px; mso-ascii-font-family: Calibri; mso-fareast-font-family: Calibri; mso-hansi-font-family: Calibri; mso-fareast-language: EN-AU; mso-no-proof: yes"><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><span style="mso-bidi-font-weight: bold"><o:p><img height="108" src="cid:bmglogo73b1ca8" width="108"></o:p></span></span></b></p>
</td>
<td style="BORDER-RIGHT: #d4d0c8; PADDING-RIGHT: 0cm; BORDER-TOP: #d4d0c8; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; WIDTH: 19cm; LINE-HEIGHT: 15px; PADDING-TOP: 0cm; BORDER-BOTTOM: #d4d0c8; HEIGHT: 61.8pt; BACKGROUND-COLOR: transparent" valign="top" width="718" height="116">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">
<b><span style="FONT-SIZE: 10pt; COLOR: #1f497d; LINE-HEIGHT: 15px; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-AU; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><font face="Calibri"><b><span style="FONT-SIZE: 10pt; COLOR: black; LINE-HEIGHT: 15px; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-AU; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast">Philip&nbsp;Pike</span></b><br>
</font></span></b><span style="FONT-SIZE: 10pt; COLOR: #1f497d; LINE-HEIGHT: 15px; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-AU; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><font face="Calibri">Director of ICT</font></span><b><span style="FONT-SIZE: 10pt; COLOR: #1f497d; LINE-HEIGHT: 15px; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-AU; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><br>
<br>
<font face="Calibri">Bacchus Marsh Grammar<br>
</font></span><span style="FONT-SIZE: 10pt; COLOR: gray; LINE-HEIGHT: 15px; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-AU; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><font face="Calibri">T.</font></span></b><span style="FONT-SIZE: 10pt; COLOR: gray; LINE-HEIGHT: 15px; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-AU; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><font face="Calibri">
 03 5366 4893&nbsp; <b>F.</b> 03 5366 4850&nbsp; <strong></strong><br>
<b>E.</b>&nbsp;pikep@bmg.vic.edu.au<span style="mso-spacerun: yes">&nbsp; </span><b>W.</b> <span style="COLOR: gray">
http://www.bmg.vic.edu.au</span></font><br>
<font face="Calibri">South Maddingley Road | PO Box 214 | Bacchus Marsh Victoria 3340</font></span><span style="FONT-SIZE: 10pt; LINE-HEIGHT: 15px; mso-ascii-font-family: Calibri; mso-fareast-font-family: Calibri; mso-hansi-font-family: Calibri; mso-no-proof: yes"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<br>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> sofdev-bounces@edulists.com.au [mailto:sofdev-bounces@edulists.com.au]
<b>On Behalf Of </b>Langham, Peter P<br>
<b>Sent:</b> Wednesday, 17 July 2013 1:00 PM<br>
<b>To:</b> Year 12 Software Development Teachers' Mailing List<br>
<b>Subject:</b> [Year 12 SofDev] U4O1 - Coding help<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Good afternoon,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I&#8217;ve been working on the Trentham Spud Inn case study available on edulists, created by Elizabeth Wells, as a guide and as practice material for my teaching for U4O1.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">In short, it&#8217;s a Pizza Restaurant ordering system that requires the following tasks:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">-<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Allow the waiter/waitress to enter the table&#8217;s order<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">-<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Allow the waiter/waitress to confirm the order with the diners at the table &#8211;
<b><span style="background:yellow;mso-highlight:yellow">removing</span> </b>or adding any requested items.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">-<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Allow special requests to be appended to the order or to individual dishes.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">-<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="color:#1F497D">Save all of the collected data into a text file<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">What is the best way to <b>remove</b> an item from the order?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I&#8217;ve been treating the order as one large string, where the diners may place an order as follows:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">String Order = &#8220;1 x Spudtastic, 1 x Butternut Pumpkin and fresh figs, 1 x Chicken breast and white truffle oil&#8221;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I think I&#8217;ll use a splitting function to separate the string at each comma so we&#8217;d end up with<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">String Order[0] = 1 x Spudtastic<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">String Order[1] = 1 x Butternut Pumpkin and fresh figs<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">String Order[2] = 1 x Chicken breast and white truffle oil<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">To remove the Butternut Pumpkin and fresh figs order<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">String Order[1] = String Order[2]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">String Order[2] = Null or &#8220;&#8221;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Is there a better way to do this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Peter Langham<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Narre Warren South P12<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p><b>Important - </b>This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether
 caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender,
 and not necessarily those of the Department of Education and Early Childhood Development.<o:p></o:p></p>
</div>
<font style="FONT-SIZE: 10pt" face="Calibri">
<hr>
PRIVATE &amp; CONFIDENTIAL<br>
The content of this e-mail and any attachments may be private and confidential, intended only for use of the individual or entity named. If you are not the intended recipient of this message you must not read, forward, print, copy, disclose, use or store in
 any way the information this e-mail or any attachment contains.<br>
If you are not the intended recipient, please notify the sender immediately and delete or destroy all copies of this e-mail and any attachments.<br>
Our organisation respects the privacy of individuals. For a copy of our privacy policy please go to our website or contact us.</font><br>
</body>
</html>