ten_year_risk team homework

docx

School

Texas A&M University *

*We aren’t endorsed by this school

Course

102

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

3

Uploaded by ProfLightning103643

Report
ENGR 102 – Ten Year Risk Lab Assignment #5a Deliverables: There are two deliverables for this team assignment: ten_year_risk.pdf ten_year_risk.py Remember to include the team header at the top of your files. For the PDF, submit to Canvas with only one team member submitting. For the .py file, each team member submits to zyBooks. Activity #1 : Writing and testing a larger program – To be done as a team In engineering and science, it is common that we want to calculate the effect of some complex behavior. To make this possible, we create a model of the behavior. A model attempts to describe the behavior in a way that is understandable and computable. Some models are based on physical laws and principles, some are based on replicating observations, and many are a combination of these. Once you have a model, you can use it to analyze and predict the performance or behavior of some system or phenomenon. In this lab, you will be using a model that has been created previously to generate a program that uses that model to give a user a prediction. In this case, you will use a model that has been developed to estimate someone’s 10-year risk for the likelihood of a heart attack, developed by the NIH. This model was constructed from data analysis of various factors that have been demonstrated to contribute to heart attacks for those ages 20-70. The process is outlined on the final page of this document: https://www.nhlbi.nih.gov/sites/default/files/publications/05-3290.pdf Note that the model works by taking several factors, assigning “point” values to them, and calculating an overall risk based on the sum of those points. Begin by putting together a document that your team will use to analyze the problem. This should be done BEFORE any coding. This document should be saved as a PDF with filename ten_year_risk.pdf and completed before writing the program for Activity 2. Your team should review the table on the last page of the document referenced above, and ensure you understand how it works. Begin by considering what values you need to store, and the general steps you will need to follow in your program. Make a list of the variables you think you will need, and the names you will use. Create a sequence of steps that you will follow o Each step should be a short description of the goal of the step. The steps should not be code, but rather a description of the purpose of an action in English. Each step should be the equivalent of no more than a few lines of code. “Compute points based on age” might be a good description of a step. o If you have a conditional statement (you should have several!), you might want to indicate each part of the condition as a separate action.
Next, determine a set of test cases. Create a list of test cases that you will use in your program. Be sure to handle both “typical” and “edge” cases. Do this before writing the program itself! You can also create “intermediate” test cases. That is, your test cases do not have to be for the entire program, but you could write a test to verify that a particular part of your program is working. For this program, a “good” set of test cases would involve well over 100 tests, since many of the values to test are just to be pulled from tables. You do not have to give a full set, but o Your team should have a minimum of 40 different test cases (more is fine) o Your test cases should include both “typical” and “edge/corner” cases o Your test cases should address each part of the program (e.g. don’t just test the age- based points for men) For each test case, you should provide the inputs for the case, the expected output, and identify the type of case (“typical” or “edge/corner” case). 1. Inputs: Sex: Male, Age: 62; Output: Age-based score: 10; Type: typical 2. Inputs: Sex: Female, Age: 20, etc. etc.; Output: 10-year risk: <1%; Type: edge You will probably find it easiest to divide up the work among your team for creating test cases. It will be easier to read if you put them all into a table, and number them. Your PDF should contain your variable list, your sequence of steps, and your test cases. Activity #2 : Constructing your program – To be done as a team As a team, construct your program and name the file ten_year_risk.py . As you do this, please be sure to do the following: Include comments for your program. It’s a good idea to begin by converting your list of steps into comments. Develop incrementally. Write some code then test it before writing the next section of code. Don’t let your teammates skip this! Be sure your program runs and passes all of your test cases. You should, in the process of developing, test every single one of the test cases you put together in Activity 1. This is a good way to check your code and see if it passes the test cases there. Assume the user enters valid input only. Your code does not have to handle malicious users. Your code should output in the format shown below. User input is shown as bold and red text. Output (using inputs: female, 36, non-smoker, 105 total cholesterol, 60 HDL, blood pressure 100/75, not taking blood pressure medication): Enter your sex (M/F): F Enter your age (years): 36 Do you smoke cigarettes (Y/N)? n Enter your total cholesterol (mg/dL): 105 Enter your HDL cholesterol (mg/dL): 60 Enter your systolic BP (mmHg): 100 Are you taking blood pressure medication (Y/N)? N Your 10-year risk of a heart attack is <1%
There is a second output test in the zyBooks as well using inputs(male, 79, smoker, 260 total cholesterol, 201HDL, 161 systolic, and not taking blood pressure meds.) OUTPUT: Your 10-year risk of a heart attack is 25%
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help