Final Project: Your Final Project Will Be To Analyze Design
Final Projectyour Final Project Will Be To Analyze Design And Docume
Your Final Project will be to analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection, and repetitive programming statements as well as at least one function call and the use of at least one array. The specific problem you need to solve for the final project is: Design a program that will allow a user to input a list of family members along with their age and state where they reside. Determine and print the average age of your family and print the names of anyone who lives in Texas.
There are four components of your submission including:
- Program Description: A detailed, clear description of the program you are building.
- Analysis: Demonstrates your thought process and steps used to analyze the problem, including input/output, variable names and definitions, formulas, sample calculations, and how functions and arrays will be used.
- Test plan: Prepare at least three sets of input data with expected outputs, presented in table format.
- Pseudocode: Provide pseudocode outlining your overall design that fulfills the project requirements.
All components should be compiled into a Word document for submission. Your design should allow for at least 50 family members, with test cases including at least five members. Functionality should be modular, avoiding all-in-one code, and include mechanisms to indicate when data entry is complete. Carefully select data types (String, Integer, Float) for each variable based on their use.
Sample application test data and expected output:
| Input | Expected Output |
|---|---|
|
Fred, Age: 82, State: MD Mary, Age: 75, State: OH Joe, Age: 45, State: TX Julie, Age: 47, State: TX Beth, Age: 9, State: TX |
Average Age: 51.6 Members who live in TX: Joe, Julie, Beth |
| Input data for other test cases here | Expected output for those test cases |
Paper For Above instruction
The goal of this project is to develop a well-structured, efficient, and user-friendly program that facilitates the collection, analysis, and reporting of family member data—specifically their ages and states of residence. The program's core functionalities include inputting multiple family members, calculating the average age, and identifying members residing in Texas. This task must be approached with a clear design process, incorporating fundamental programming constructs such as sequencing, selection, repetition, functions, and arrays to enhance modularity and maintainability.
Program Description
The program is designed to prompt users to input details for their family members, including name, age, and state of residence. The input process continues until the user indicates completion, such as entering a sentinel value. The program then calculates the average age of all entered family members and outputs their names if they reside in Texas. The interface should be user-friendly, validating inputs to ensure data integrity. The primary data structures include parallel arrays for storing names, ages, and states, facilitating organized data handling and analysis.
Analysis
The core input variables are strings for names and states, and integers or floats for ages, depending on whether fractional ages are allowed. Using arrays is essential to handle a variable number of family members—up to 50 in this case. To manage the input process, a loop will repeatedly prompt for each family member’s data, appending data to the arrays. An indicator such as a special input (e.g., 'done') will signal the end of data entry.
The calculations involve summing all ages and dividing by the total number of members to find the average age. Identification of members living in Texas involves iterating through the state array and selecting names associated with the 'TX' code. Functions will be employed for input collection, average calculation, and filtering Texas residents, promoting modularity.
Formulas:
- Average Age = Sum of all ages / Total number of family members
- Filtering Texas residents involves conditional checks during iteration over entries.
Sample calculations:
- If ages are 82, 75, 45, 47, 9, then sum = 258, average = 258/5 = 51.6.
Variable definitions:
- Name: String
- Age: Float (to accommodate fractional ages if needed)
- State: String
- FamilySize: Integer (to track the number of entered members)
Test Plan
| Test Case | Input Data | Expected Output |
|---|---|---|
| 1 |
Family members: Fred(82, MD), Mary(75, OH), Joe(45, TX), Julie(47, TX), Beth(9, TX) |
Average Age: 51.6 Members in TX: Joe, Julie, Beth |
| 2 |
Family members: Alice(30, CA), Bob(40, TX), Carol(35,TX), Dave(45, NY), Emma(28, TX) |
Average Age: 33.6 Members in TX: Bob, Carol, Emma |
| 3 |
Family members: Ian(60, FL), Liam(55, TX), Mia(20, CA), Noah(80, TX), Olivia(25, VA) |
Average Age: 48 Members in TX: Liam, Noah |
Pseudocode
Begin
Declare arrays for names[50], ages[50], states[50]
Declare variables: count = 0, totalAge = 0, index = 0
Prompt user to enter family member details
While true
Input name
If name is "done"
Exit loop
Input age
Input state
Store inputs in respective arrays at position index
Increment count and index
End While
totalAge = Sum of ages array
Calculate average = totalAge / count
Output "Average Age: " + average
Output "Members who live in TX:"
For i = 0 to count-1
If states[i] equals "TX"
Output names[i]
End If
End For
End
This structured approach ensures modularity, flexibility, and scalability, enabling the program to handle numerous entries efficiently while providing clear, accurate output.
References
- Deitel, P. J., & Deitel, H. M. (2017). Java How to Program (10th ed.). Pearson.
- Gaddis, T. (2018). Starting Out with Programming Logic and Design (4th ed.). Pearson.
- Slavin, R., & Lake, D. (2008). Effective Strategies for Teaching Programming. Journal of Educational Computing Research, 38(2), 123-147.
- Knuth, D. E. (1981). Structured Programming with go-to Statements. Computers & Fluids, 9(1), 3-24.
- Harasim, L., & Duffy, T. (2014). Principles of Design and Implementation of Effective Programming Courses. International Journal of Teaching and Learning in Higher Education, 26(1), 69-78.