by @Carl Air Fork
{"functions":[],"name":"digitProcessor","main":{"rawId":"main","tpe":"Void","name":"main","statements":[{"@type":"Begin","id":"id_b9095b60_adee_478f_81d3_633ae65c2e82"},{"@type":"Comment","id":"id_727c8045_606b_4e6a_b88d_10e54eea87b8","text":"declare a variable to hold a multi-digited integer"},{"@type":"Declare","tpe":"Integer","name":"num","id":"id_4e513947_c1c5_47ad_a8f5_cdacf2b907d0","initValue":null},{"@type":"Comment","id":"id_73fb8182_8729_4d29_a2f1_3a85405e66ff","text":"declare a variable to hold the remainder as the number is processed"},{"@type":"Declare","tpe":"Integer","name":"remainder","id":"id_455d2cdb_b183_4ff6_9502_7c7150f5275d","initValue":null},{"@type":"Comment","id":"id_8fdc8129_19d4_4272_b01c_45f69987c995","text":"declare a variable to hold the value of the sum of the digits"},{"@type":"Declare","tpe":"Integer","name":"sum","id":"id_5323ddda_5163_4b83_bcf7_9be7d69df03d","initValue":null},{"@type":"Comment","id":"id_ae38f0d7_69ed_46a1_81c5_e3113808acc3","text":"declare a variable to hold the value that allows for the user to repeat the process of entering a number"},{"@type":"Declare","tpe":"String","name":"repeat","id":"id_c92e5aa5_fd06_41f8_9394_13d967b53201","initValue":null},{"condition":"repeat == \"y\" || repeat == \"yes\"","@type":"DoWhile","id":"id_7c83d1c1_1cc7_48cf_89eb_64549d64d82e","body":{"statements":[{"@type":"Comment","id":"id_45b4b72a_8b59_422e_aef8_f4dcf4089992","text":"use an output to prompt the user to enter the multi-digit number"},{"@type":"Input","name":"num","id":"id_4a7b34a0_0ccb_4539_83ce_b73661b06f09","prompt":"Enter a positive number: "},{"@type":"Comment","id":"id_9d152746_6859_42c3_bdae_34effc5b7092","text":"use a loop to check to see if the number is not greater than 0 (while num <= 0)"},{"condition":"num <= 0","@type":"While","id":"id_18a7aee6_d25c_4c9d_b8fc_67e3758002e1","body":{"statements":[{"@type":"Comment","id":"id_69dab53c_540f_42b1_9500_8488dafbd8b6","text":"if the number is not greater than 0, then re-prompt the user to enter another number"},{"newline":true,"@type":"Output","id":"id_82653783_6000_4183_9a31_1f8965e3e6d1","value":"\"ERROR: Number must be positive. Try again.\""},{"@type":"Input","name":"num","id":"id_79024a6e_8ee6_483e_9d65_767199837921","prompt":"Enter a positive number: "}],"id":"id_36be8e40_4668_48a2_8d8b_4b4e4a90c4c9"}},{"@type":"Comment","id":"id_812a1935_c1a7_4941_82bd_5b1f29887b53","text":"otherwise, continue with the program"},{"@type":"Assign","name":"sum","id":"id_224205a8_4713_4b63_88c8_b8d092323060","value":"0"},{"@type":"Comment","id":"id_717b032a_d556_4ea0_926e_f82ae8ca1ba5","text":"start the loop that processes the sum of the digits (while num > 0)"},{"condition":"num > 0","@type":"While","id":"id_12d6ee4f_16e8_456a_9f45_504724aaecf7","body":{"statements":[{"@type":"Comment","id":"id_ed6ad250_2e70_4506_8058_210a4ac1449c","text":"calculate the remainder (last digit) by taking the original number and % by 10"},{"@type":"Assign","name":"remainder","id":"id_c9e91b89_c051_4d3d_87fc_1ff056dc5031","value":"num % 10"},{"@type":"Comment","id":"id_ce45cdc2_4b5a_43f5_bff9_493b2828bdcb","text":"take the remainder (last digit) and add it to the sum"},{"@type":"Assign","name":"sum","id":"id_3c762c14_bc57_42d7_a0f2_81de718636a9","value":"sum + remainder"},{"@type":"Comment","id":"id_15db35dc_e63c_41cc_b510_f18d10ec6635","text":"update the value of the original number by dividing by 10"},{"@type":"Assign","name":"num","id":"id_94b74ae8_69cb_4ddd_8106_7492765ddef5","value":"num / 10"}],"id":"id_442a4929_8457_4b6a_8662_2e2942c98af8"}},{"@type":"Comment","id":"id_90aebe8a_cc9c_4073_885d_2b7c5724811f","text":"once the original number is less than or equal to 0, display the sum"},{"newline":true,"@type":"Output","id":"id_746bf53b_74b6_4647_81c5_4df6c9c9b154","value":"\"Sum of digits = \" + sum"},{"@type":"Comment","id":"id_91b7696b_225f_4698_885f_0b1e848ef872","text":"ask the user to repeat the process"},{"@type":"Input","name":"repeat","id":"id_3c587c4b_e9d7_4b25_bcce_849832971303","prompt":"Would you like to repeat? (yes/y) "}],"id":"id_512b6619_6b08_44a6_b898_aa622f1c8ede"}},{"newline":true,"@type":"Output","id":"id_4337435a_69df_403a_ada6_05ffc83a68c6","value":"\"Thank you for using the program.\""},{"@type":"Return","id":"id_e0ca9bf7_74d6_43fb_8a6f_ea3a51f8fda3","maybeValue":null}],"parameters":[]},"id":"id_51fa4f59_d24e_446f_8bfd_072482f5c303","config":{"showDebugVars":true,"showIoBtns":true,"showFunctions":true,"lang":"java","showGenCode":true},"version":"0.2","revision":259}