by @sheyli Fork
{"functions":[],"name":"Test Score Average","main":{"rawId":"main","tpe":"Void","name":"main","statements":[{"@type":"Begin","id":"id_aee5b6af_6058_4cb0_b103_62595d91eeb9"},{"@type":"Comment","id":"id_13a5cb31_fff4_4591_aa16_386feb5d20ec","text":"This calculates the average test score of a student. It repeatedly asks the user to enter scores between 0-100. If there is an invalid score (less than 0 or greater than 100), the program displays an error message and asks for the score again."},{"@type":"Comment","id":"id_99b6f2f9_8f7c_4eec_aa6f_8c8eb75fddbb","text":"The loop continues until the user types -1 to indicate that they are done. Once the scores are entered, the program calculates and shows the total number of valid scores, the sum, and the average. If there is no valid scores, it puts a message that no valid scores were entered."},{"@type":"Comment","id":"id_0f29e38c_0fc1_4993_963d_6d2fc206dceb","text":"By:"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"score","lengthValue2":"5","id":"id_8347be68_fac6_4d9d_861e_6d1e05fe17b3","initValue":null},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"total","lengthValue2":"5","id":"id_c93a5a5b_06c2_46be_bcfe_184d72ccef70","initValue":"0"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Integer","name":"count","lengthValue2":"5","id":"id_c498f288_64f7_48cf_a859_92969c370162","initValue":"0"},{"lengthValue":-1,"@type":"Declare","lengthValue1":"5","tpe":"Real","name":"average","lengthValue2":"5","id":"id_6a90f679_c7c6_4b7c_993b_61b6db416b7d","initValue":null},{"newline":true,"@type":"Output","id":"id_51447ddd_3084_4cc0_82ec_4bbd7cb5ef83","value":"\"Enter test scores from 0 to 100.\""},{"newline":true,"@type":"Output","id":"id_845ef212_668b_4197_af18_c322e2f2f4a8","value":"\"To end the program, enter -1\""},{"@type":"Input","name":"score","id":"id_cdd34b99_bd8d_4d87_aaed_d54b6bc61cf9","prompt":"Enter score:"},{"condition":"score != -1","@type":"While","id":"id_7e696fe3_70f3_4d7c_8ce6_c88cd103888f","body":{"statements":[{"falseBlock":{"statements":[{"@type":"Assign","name":"total","id":"id_2012733a_f2eb_4d64_88bf_518c197dca63","value":"total + score"},{"@type":"Assign","name":"count","id":"id_ee316cda_163d_4926_b0d0_fb287c438fab","value":"count + 1"},{"@type":"Input","name":"score","id":"id_c24866c2_7074_4c3d_9f60_9e723950378e","prompt":"Enter score:"}],"id":"id_8aa20f02_c585_492f_91cb_ae744c04f86e"},"trueBlock":{"statements":[{"newline":true,"@type":"Output","id":"id_a4957957_3b51_491a_b44f_829de60b3460","value":"\"Score must be from 0-100. Try again\""},{"@type":"Input","name":"score","id":"id_4c25b370_0c58_4c4d_9b77_2165d3f4d757","prompt":"Enter score:"}],"id":"id_9e78cc42_3fb3_44cb_b55b_37311e83a6db"},"condition":"score < 0 || score > 100","@type":"If","id":"id_9dafd208_9e58_4133_bdb6_7df38be337d0"}],"id":"id_aa88f43b_e05c_404a_9d06_9ef2f763b640"}},{"falseBlock":{"statements":[{"newline":true,"@type":"Output","id":"id_cc49d1af_d113_47d4_a753_d5c39994834d","value":"\"No valid scores entered.\""}],"id":"id_a89d913f_d177_4560_9aea_ff20607fc564"},"trueBlock":{"statements":[{"@type":"Assign","name":"average","id":"id_14b509f6_4818_44c2_9523_073b6f6ccf0a","value":"total / count"},{"newline":true,"@type":"Output","id":"id_39b36afd_39e6_4bfe_817d_c44d68824fa8","value":"\"Score count: \" + count"},{"newline":true,"@type":"Output","id":"id_9acb4c11_191b_4d09_bd06_a4a647a354a7","value":"\"Score total: \"+ total"},{"newline":true,"@type":"Output","id":"id_450ff712_668e_4fe3_a16f_5103636f7277","value":"\"Average score: \" + average"}],"id":"id_b23a939d_20fc_4695_928a_bb43d30e3c6c"},"condition":"count > 0","@type":"If","id":"id_58489bf8_a8a4_45ee_b028_b2612a5b3d43"},{"@type":"Return","id":"id_9de1d3ef_accc_47f2_9255_dd8d52cb3213","maybeValue":null}],"parameters":[]},"id":"id_7226c16c_4280_4f47_8eb1_d0d932c85e43","config":{"showDebugVars":true,"useInputPrompt":true,"echoEnteredValue":true,"showIoBtns":true,"showFunctions":true,"lang":"java","showGenCode":true},"version":"0.3","revision":1185}