gh
Name: _______________________________ CIS 125 Test 3 100 Points Total Be sure to completely read and follow the below directions! Directions for Test Program (Read CAREFULLY and follow COMPLETELY): · Create the following program in Python that performs the purpose described. Use the sample output (with user input where applicable) to help you test the program and make your outputs look like it, including the input prompts. · Include at least three lines of comments/remarks in the program, in addition to including your name, the date, and a description of the program. · Upload your .py source file to Moodle into the Test 3 Assignment. · Upload a Word file containing pseudocode or a flowchart for the program that you are coding to the same location as the .py file. · Submit this sheet with your answers to the extra credit questions. · Be sure to adhere to the college and course academic honesty policy. Problem Statement: Create a Python program with two user-defined functions/modules that works in the following way: 1. The main part of the program will ask a user if they have weights to enter. Use an if/else block to handle the logic: if they answer no, the program will exit or if they answer yes (see sample input/output for how to format this), main will call a single function, passing in no data, but the function will prompt the user to enter a starting weight. It will then return this weight value to the main part of the program, placing the value into the variable on its call line. Your default statement will handle a bad entry and exit. See the sample output for what this should look like. 1. Once the initial weight is entered the program will ask the user how many additional weights the user wants to enter. The program will enter a loop and accumulate the appropriate amount of weights. Each retrieval will be done by calling another function, passing in no data, but returning a new weight, placing the value into the variable on its call line and then accumulating the value. Once this is complete, an average of all of the new weights will be calculated by the program. Average = Accumulated New Weights / Number of New Weights. 1. The main will then call another function, passing in the original weight and the averaged new weights. The called function will figure out the difference between the weights (starting weight – new weight). Next, the function will then figure out if the weight loss is negligible (less than 2 pounds lost), moderate (between 2 and 6 pounds lost) and extreme (greater than 6 pounds lost). If weight gain occurred, state that the patient gained weight and no loss occurred. If the weight is the same, say that there was no weight gain or loss. Both the starting weight and the averaged new weight will be output as well. See the different sample inputs/outputs to see what each one should say. 1. Extra Credit (10 Points): Utilize an input validation loop to validate the following user inputs: 3. The number of new weights entered should be greater than 0 but equal to or less than 10. 3. All weights entered should be greater than 75 pounds but less than 400 pounds. Sample Output/Input 1 (negligible weight loss, one new weight): Do you have weights to enter? 1. Yes 2. No 1 Please enter the starting weight: 150 How many new weights do you have to enter? 1 Please enter the new weight 1: 149.5 The starting weight was 150 and the averaged new weights was 149.5. The weight loss was negligible. No additional action is necessary. Thank you and have a great day! Sample Output/Input 2 (moderate weight loss two new weights): Do you have weights to enter? 1. Yes 2. No Please enter the starting weight: 150 How many new weights do you have to enter? 2 Please enter the new weight 1: 148 Please enter the new weight 2: 148 The starting weight was 150 and the averaged new weights was 148. The weight loss was moderate. Monitor patient closely. Thank you and have a great day! Sample Output/Input 3 (extreme weight loss, 3 new weights): Do you have weights to enter? 1. Yes 2. No 1 Please enter the starting weight: 150 How many new weights do you have to enter? 3 Please enter the new weight 1: 144 Please enter the new weight 2: 143 Please enter the new weight 3: 142 The starting weight was 150 and the averaged new weights was 143. The weight loss was extreme. Dietician intervention required. Thank you and have a great day! Sample Output/Input 4 (Weight Gain, 2 new weights): Do you have weights to enter? 1. Yes 2. No 1 Please enter the starting weight: 150 How many new weights do you have to enter? 2 Please enter the new weight 1: 156 Please enter the new weight 2: 154 The starting weight was 150 and the averaged new weights was 155. There was weight gain with no loss. No intervention currently required. Thank you and have a great day! Sample Output/Input 5(no weight change, 4 new weights): Do you have weights to enter? 1. Yes 2. No 1 Please enter the starting weight: 150 How many new weights do you have to enter? 3 Please enter the new weight 1: 148 Please enter the new weight 2: 149 Please enter the new weight 3: 151 Please enter the new weight 4: 152 The starting weight was 150 and the averaged new weights was 150. There was no loss or gain. No intervention currently required. Thank you and have a great day! Sample Output/Input 6(no weights to enter): Do you have weights to enter? 1. Yes 2. No 2 No weights? What are you here for? Thank you and have a great day! Sample Output/Input 3(bad entry at start): Do you have weights to enter? 1. Yes 2. No 3 Bad entry detected. Thank you and have a great day! Extra Credit (5 Points Each): 1. What is an example of a pre-test loop? What is an example of a post-test loop? 2. I have mentioned several movies this semester. What is one that I have stated is one of my favorites? 3. What loop is best used when a section of code needs to execute a specific number of times? CIS 125 Exam 3: Rubric Comments Score Pseudocode Or Flowchart /20 Logic /60 Compilation /5 Test Cases /15 Extra Credit Questions: In Code: Total: /100 Name: _______________________________ CIS 125 Test 3 100 Points Total Be sure to completely read and follow the below directions! Directions for Test Program (Read CAREFULLY and follow COMPLETELY): · Create the following program in Python that performs the purpose described. Use the sample output (with user input where applicable) to help you test the program and make your outputs look like it, including the input prompts. · Include at least three lines of comments/remarks in the program, in addition to including your name, the date, and a description of the program. · Upload your .py source file to Moodle into the Test 3 Assignment. · Upload a Word file containing pseudocode or a flowchart for the program that you are coding to the same location as the .py file. · Submit this sheet with your answers to the extra credit questions. · Be sure to adhere to the college and course academic honesty policy. Problem Statement: Create a Python program with two user-defined functions/modules that works in the following way: 1. The main part of the program will ask a user if they have weights to enter. Use an if/else block to handle the logic: if they answer no, the program will exit or if they answer yes (see sample input/output for how to format this), main will call a single function, passing in no data, but the function will prompt the user to enter a starting weight. It will then return this weight value to the main part of the program, placing the value into the variable on its call line. Your default statement will handle a bad entry and exit. See the sample output for what this should look like. 1. Once the initial weight is entered the program will ask the user how many additional weights the user wants to enter. The program will enter a loop and accumulate the appropriate amount of weights. Each retrieval will be done by calling another function, passing in no data, but returning a new weight, placing the value into the variable on its call line and then accumulating the value. Once this is complete, an average of all of the new weights will be calculated by the program. Average = Accumulated New Weights / Number of New Weights. 1. The main will then call another function, passing in the original weight and the averaged new weights. The called function will figure out the difference between the weights (starting weight – new weight). Next, the function will then figure out if the weight loss is negligible (less than 2 pounds lost), moderate (between 2 and 6 pounds lost) and extreme (greater than 6 pounds lost). If weight gain occurred, state that the patient gained weight and no loss occurred. If the weight is the same, say that there was no weight gain or loss. Both the starting weight and the averaged new weight will be output as well. See the different sample inputs/outputs to see what each one should say. 1. Extra Credit (10 Points): Utilize an input validation loop to validate the following user inputs: 3. The number of new weights entered should be greater than 0 but equal to or less than 10. 3. All weights entered should be greater than 75 pounds but less than 400 pounds. Sample Output/Input 1 (negligible weight loss, one new weight): Do you have weights to enter? 1. Yes 2. No 1 Please enter the starting weight: 150 How many new weights do you have to enter? 1 Please enter the new weight 1: 149.5 The starting weight was 150 and the averaged new weights was 149.5. The weight loss was negligible. No additional action is necessary. Thank you and have a great day!