Project Plan Your final project will be to analyze, design, and document a simpl
ID: 3557747 • Letter: P
Question
Project Plan
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 your 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.
For this part of the deliverable, there are 2 components of your submission including:
Additional details about the program you need to write:
Explanation / Answer
//Main Method
MAIN
//variable declarations
//create parallel array to store family members information
//array of Strings for family names
DECLARE names[10] of STRING
//array of ages for family members
DECLARE ages[10] of INTEGER
//array of states where they reside
DECLARE states[10] of STRING
//stores the total number of family members
//as entered by user
DECLARE count as INTEGER
//age average
DECLARE average as FLOAT
DECLARE count as INTEGER
SET count = 10
//declare variables to store current user input
DECLARE name as STRING
DECLARE age as INTEGER
DECLARE state as STRING
//prompt for family member count
WRITE "How many family members do you have? "
//read the value from user
INPUT count
//use for loop to prompt user to enter information
//for all family members
//repeat the loop "count" times
FOR (COUNTER=1; counter <= count; COUNTER++)
//prompt for name
WRITE "Enter family member name: "
INPUT name
//prompt for age
WRITE "Enter family member age: "
INPUT age
//prompt for state
WRITE "Enter family member state: "
INPUT state
//store input values in the array
SET names[COUNTER] = name
SET ages[COUNTER] = age
SET states[COUNTER] = state
END FOR //continue with next iteration
//at this point all values are in the array
//call calculate average submodule and store result to variable
CalculateAverageAge(ages,count, averag)
//print average
WRITE "The average age of all family members is ", average
// call method to print whose who live in texas
CALL DisplayMembersInTexas(names, states, count);
END main
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.