Access over 20 million homework & study documents

Problem Statement

Content type
User Generated
Type
Study Guide
Rating
Showing Page:
1/9
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:
• Program Description - A detailed, clear description of the program you are building.
Problem Statement:
The program is to allow a user to input a list of their family members along with their age and
state they reside. The program will calculate the average age of all family members and display
the average age. Also it will display the names of the family members who live in Texas.
• Analysis- Demonstrates your thought process and steps used to analyze the problem. Be
sure to include the required input and output and how you will obtain the required output
from the given input? Also, include your variable names and definitions. Be sure to
describe the necessary formulas and sample calculations that might be needed. Talk about
the functions you plan to use and how you will use arrays. Be sure to talk about the types of
programming statements that will be used on why.
Analysis:
The program will use a modular approach to get the process done. There will be 3 functions. One
function to get input from user i. e., get family members’ age and the state they reside. The other
function is to calculate the average age of all family members and third function to display
output, i.e., average age and name of persons who live in Texas.
Required Input: Name, age and state of each family member.
Arrays will be used to hold information and to get user input in a loop.
1. WHILE name<> “” OR index < MAXCOUNT
a. SET Names[index] = name
b. DISPLAY “Enter ” + Names[index] + “ age: ”
c. INPUT Age[index]
d. DISPLAY “Enter ” + Names[index] + “ state of residence: ”
e. INPUT State[index]
f. SET index = index + 1
g. DISPLAY “Enter family member name, ENTER to end: ”
h. INPUT name
2. END WHILE
Required Output: Average age and names of family members who live in Texas.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/9
Steps to get output from input:
1. Calculate sum of age of all family members.
2. Divide sum of ages by the total number of family members to get the average age.
3. Iterate on states of family members. If state is Texas then display family member name.
Data dictionary:
Sr. No.
Variable Name
Data Type
Description
1.
Names[]
String
Array to hold family members
names
2.
Age[]
Integer
Array to hold family members age
3.
State[]
String
Array to hold family members state,
where they reside
4.
MAXCOUNT
Integer
constant
Size of the array. Constant integer to
hold maximum number of family
members.
5.
Number_of_family_members
Integer
Variable to hold actual number of
family members input by user.
6.
Sum_of_age
Integer
Variable to hold sum of family
members age
7.
Average_age
Decimal
Variable to hold average of family
members
8.
index
Integer
Index variable to iterate on arrays.
Formulas and sample calculations:
1) Formula to load the arrays and determine Number_of_family_members
The program will create arrays of size MAXCOUNT. This variable is defined in the beginning of
the code. The program will ask the user to enter the details in a loop:
WHILE name<> “” OR index < MAXCOUNT
this loop will run until user enter blank value for name or the index is less than MAXCOUNT
once the loop is executed, the variable 'index' will be used to determine
Number_of_family_members
2) Formula for finding the average age.
This formula needs the for loop, and the index for the array is used to get the data out of the age
array
1. FOR index = 0 TO count 1
a. SET sum = sum + Age[index]

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/9

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 9 pages?
Access Now
Unformatted Attachment Preview
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: • Program Description - A detailed, clear description of the program you are building. Problem Statement: The program is to allow a user to input a list of their family members along with their age and state they reside. The program will calculate the average age of all family members and display the average age. Also it will display the names of the family members who live in Texas. • Analysis- Demonstrates your thought process and steps used to analyze the problem. Be sure to include the required input and output and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed. Talk about the functions you plan to use and how you will use arrays. Be sure to talk about the types of programming statements that will be used on why. Analysis: The program will use a modular approach to get the process done. There will be 3 functions. One function to get input from user i. e., get family members’ age and the state they reside. The other function is to calculate the average age of all family members and third function to ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Really great stuff, couldn't ask for more.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4