by @jessele Edwards Fork
{"functions":[],"name":"digitProcessor","main":{"rawId":"main","tpe":"Void","name":"main","statements":[{"@type":"Begin","id":"id_9d90d7ce_666f_46aa_a585_10b78b86feb9"},{"@type":"Comment","id":"id_af980f1f_bb22_4769_a53b_ac78e4732266","text":"declare a var to hold multi-digit integer"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"num","lengthValue2":"5","id":"id_105e5700_27ca_4f92_b721_e36782bd6401","initValue":null},{"@type":"Comment","id":"id_635b324d_9dcf_4e08_b182_61d2ab22b54b","text":"declare a var to hold the remainder as the number is processed"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"remainder","lengthValue2":"5","id":"id_033bf2dc_ba40_4b0a_a877_950c68f3689a","initValue":null},{"@type":"Comment","id":"id_080ab227_0673_458b_8114_fea579cddbda","text":"declare a var to hold the value that allows the user to repeat the process of entering number"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"String","name":"repeat","lengthValue2":"5","id":"id_ab27314c_6998_4620_bf15_4ca50db9fd9a","initValue":null},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"sum","lengthValue2":"5","id":"id_ab21c623_0d08_4b4d_b26e_7af1ab789716","initValue":"0"},{"condition":"repeat == \"y\" || repeat == \"Y\"","@type":"DoWhile","id":"id_15e78e88_9407_4462_975c_38d30360946b","body":{"statements":[{"@type":"Comment","id":"id_41807aaa_a0f2_4751_87f0_9616c06903e6","text":"use an output to prompt user to enter multi-digit number"},{"newline":true,"@type":"Output","id":"id_01df3fe0_e7d7_456c_a51e_33468ee83524","value":"\"Enter a positive number: \""},{"@type":"Input","name":"num","id":"id_388d7acf_69f7_4d0d_8df5_df9aa116dc56","prompt":null},{"@type":"Comment","id":"id_5c5492b3_6f79_4d8a_a4de_73d9bb26bde2","text":"use a loop to check to see if the number is not greater the 0 (while num <= 0)"},{"condition":"num <= 0","@type":"While","id":"id_3e5740c0_e625_4503_a338_59ce594c31ae","body":{"statements":[{"@type":"Comment","id":"id_d1ed58ec_6f6b_4bc8_92a8_913e0273acda","text":"if the number is not great than 0, re-prompt the user to enter another number"},{"newline":true,"@type":"Output","id":"id_cbf3a65a_94f4_49d7_9d26_77b1fbdd2eb1","value":"\"Error: Number must be a positive. Try Again. \""},{"newline":true,"@type":"Output","id":"id_7c131a8e_d634_4ca4_8729_990326e1309d","value":"\"Enter a positive number: \""},{"@type":"Input","name":"num","id":"id_032362a0_88c3_4f55_8bb3_2ef983738406","prompt":null}],"id":"id_446fefd8_4b4e_4963_a7da_00ad43adab3f"}},{"@type":"Comment","id":"id_19ed12b9_2edd_4413_a8ab_7e3848a719d0","text":"otherwise, continue with the program"},{"@type":"Comment","id":"id_0bd7b9cd_ec5b_4bac_8eff_ee8ce8aaa751","text":"next, declare a var to hold the value of the sum of the digits"},{"@type":"Assign","name":"sum","id":"id_fbb34f95_a644_4d16_8158_a280486afbb4","value":""},{"@type":"Comment","id":"id_957a9c71_f92b_4772_b37e_536485af1933","text":"start the loop that processes the sum of the digits (while num > 0)"},{"condition":"num > 0","@type":"While","id":"id_4e7a27a5_4f24_4f65_8f9f_a83aba050101","body":{"statements":[{"@type":"Comment","id":"id_4dd10397_4d39_499d_b314_152d62ab9640","text":"calculate the remainder (last digit) by taking the original number and % by 10"},{"@type":"Assign","name":"remainder","id":"id_349269d2_ebb0_43fb_b262_3a1351ebd1e1","value":"num % 10"},{"@type":"Comment","id":"id_55c276ab_b9aa_4e83_995e_260a1c221d0a","text":"take the remainder (lst digit) and add it to the sum"},{"@type":"Assign","name":"sum","id":"id_12e736f0_cf26_4624_87be_91a0445ff43e","value":"sum + remainder"},{"@type":"Comment","id":"id_66a5978f_c223_43bf_87cf_c8a6427dbd1a","text":"update the value of the origianl number dividing by 10"},{"@type":"Assign","name":"num","id":"id_25ed599b_9e7a_4167_9ebf_c5a683e17bea","value":"num / 10"}],"id":"id_c6316536_d5e2_45ee_aacf_54d18ef5274c"}},{"@type":"Comment","id":"id_8c3f3791_127a_4c75_9cf3_bdd35f68d90c","text":"once the original number is les than or equal to 0, display the sum"},{"newline":true,"@type":"Output","id":"id_a3fa42cc_c4fa_4937_a3bb_27ff20decfe4","value":"\"Sum of digits = \" + sum"},{"@type":"Comment","id":"id_9ec5a6d0_4393_4174_9968_ce7182ded47f","text":"ask the user to repeat the process"},{"newline":true,"@type":"Output","id":"id_3d9637ef_eb1d_4f83_92f4_87e9b8070e42","value":"\"Would you like to repeat the process (y/Y)? \""},{"@type":"Input","name":"repeat","id":"id_740bf1d9_b40f_4922_a4e4_3e5df461ade6","prompt":null}],"id":"id_d69a0efe_35d4_435c_a64e_e66c35d9c532"}},{"newline":true,"@type":"Output","id":"id_95dc806c_90be_4b37_bb28_a46788ac4527","value":"\"Thank you for using the program! \""},{"@type":"Return","id":"id_615acc07_be57_4dac_b0ec_127ade988ea1","maybeValue":null}],"parameters":[]},"id":"id_2b6f68f5_2ed5_4090_b487_0499f80b4ac4","config":{"showDebugVars":true,"useInputPrompt":false,"echoEnteredValue":false,"showIoBtns":true,"showFunctions":false,"lang":"java","showGenCode":false},"version":"0.3","revision":482}