by @Ainsley McDonald Fork
{"functions":[],"name":"Sales (mult depts)","main":{"rawId":"main","tpe":"Void","name":"main","statements":[{"@type":"Begin","id":"id_51483396_726c_486c_b54c_8d039584db54"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"numdept","lengthValue2":"5","id":"id_252c62b4_bbbc_44bd_89f6_5fd40e7b6e35","initValue":"3"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"numquat","lengthValue2":"5","id":"id_49375a0a_b58c_4126_a0e8_c6e575c0eaa6","initValue":"4"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"3","tpe":"RealMatrix","name":"sales","lengthValue2":"4","id":"id_3c15c188_8343_4d3a_8385_1cdc02bdd94f","initValue":null},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Real","name":"totalsales","lengthValue2":"5","id":"id_c015d7b9_5b4f_41a3_9269_6a6751255929","initValue":null},{"@type":"Assign","name":"totalsales","id":"id_26703c37_aa48_46f6_8b1f_a62882b521ea","value":"0"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"dept","lengthValue2":"5","id":"id_e0aacf5b_031c_4df0_8ede_f4ae733b8531","initValue":null},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"quat","lengthValue2":"5","id":"id_ef5a078c_79a6_45a0_98e1_b55d3e9233f2","initValue":null},{"@type":"Comment","id":"id_99955df0_7426_407d_ad20_a04fd147ce92","text":"identify variables"},{"varName":"dept","incr":"1","@type":"ForLoop","start":"0","end":"numdept-1","id":"id_c13b7a67_df95_43b5_a040_46453ab4f79f","body":{"statements":[{"@type":"Comment","id":"id_9aa5b7cb_dc28_4a57_bb48_5a8a352c53ed","text":"get quantities for all values for all depts"},{"newline":true,"@type":"Output","id":"id_59c4270f_79d1_49d8_9ad4_b560d211c528","value":"\"Entering sales for Department \" + (dept + 1)"},{"varName":"quat","incr":"1","@type":"ForLoop","start":"0","end":"numquat-1","id":"id_0f58e5ef_2cf9_4b3e_8157_1387bfb77d7d","body":{"statements":[{"newline":true,"@type":"Output","id":"id_2329aa9f_2f59_459d_8a62_77db2a8eccb4","value":"\" Enter sales for Quarter \" + (quat + 1) + \": \""},{"@type":"Input","name":"sales[dept][quat]","id":"id_f452c46e_6a52_4e57_8275_428480e58499","prompt":"Please enter x:"}],"id":"id_2dd07316_c81a_44a9_84d6_b3cd160ed925"}}],"id":"id_6558d96f_7ba7_4640_9a60_3365565f3cb6"}},{"@type":"Comment","id":"id_bc3ae018_e45e_4572_a135_613dbe30c075","text":"calc quantities for all values for all depts"},{"varName":"dept","incr":"1","@type":"ForLoop","start":"0","end":"dept-1","id":"id_32563651_034e_4ab3_bf6c_e4591226f5c9","body":{"statements":[{"varName":"quat","incr":"1","@type":"ForLoop","start":"0","end":"numquat-1","id":"id_2f3d4a20_903b_4efa_be0f_81ffeb3d4985","body":{"statements":[{"@type":"Assign","name":"totalsales","id":"id_5985ae94_71d3_4df2_ab64_33418862c525","value":"totalsales + sales[dept][quat]"}],"id":"id_884ec459_8a72_4405_9e58_92ed4f8a24c1"}}],"id":"id_6f692b2c_17aa_4ebe_a592_4bf3d70a34d6"}},{"@type":"Comment","id":"id_8906b8f3_ede2_44ff_9c1b_0b8c52bb2fde","text":"output"},{"@type":"Comment","id":"id_cad7617f_7382_4a93_b9ed_66b7e5d8c740","text":"I could calculate costs in the 1st loop, but seperating made more sense for easier expansion to me"},{"newline":true,"@type":"Output","id":"id_7cc4ff80_5d4c_42ed_b667_ae138613573d","value":"\"Total sales for all divisions (3 departments, 4 quarters): $\" + totalsales"},{"@type":"Return","id":"id_0d78e02e_f1ef_440d_9344_9a7ab90a55be","maybeValue":null}],"parameters":[]},"id":"id_a665eac3_a59d_491d_933e_2d61c3738aae","config":{"showDebugVars":true,"useInputPrompt":true,"echoEnteredValue":false,"showIoBtns":true,"showFunctions":true,"lang":"java","showGenCode":true},"version":"0.3","revision":523}