Student Name:

Class/Section:

Professor Name:

Assignment due date:

A.  Problem Analysis

Problem Statement: Design a program that will allow a user to Input a list of their family members along with their age and state where they reside. Determine and output the average age of their family and output the names of anyone who lives in Texas.

The program is to calculate the total average age of my family members and determine their location with only printing out those members that are from Texas. The program will take inputs from the user who will input the name, age and location of each member. The program will take the years of all members entered and add them all together and then take the total of members entered and divide the total coming up with the average age. The program will also calculate and identify each state of each person entered and using the defined input identifies those people from Texas and prints their names out only. The output of the program is three fold. The total average age of all family entries, identify who is from Texas and print their name out.

Required Output:

·  Average age of all persons entered

·  Print name of person(s) from Texas ONLY

In the output description you describe the information, not what the program will do. Actions like print are not appropriate here

Required Input:

·  Name of person

·  Age of person

·  State of where person came from

This is not an adequate description of the input. The input is that set of information for an unknown number of people. Your description seems to say that only a single person will be input.

Need to say how the end of the input is marked

The program will take inputs and calculate the average of all of the ages entered, identify which persons are from Texas and print their name.

An array will be used to hold the data for calculating who comes from Texas

First of all, the user will be asked to enter name, age and state of family members in a sentinel loop. Then, an array will be used to hold number of names for total count. In each iteration, user inputted values will be stored in respective arrays locations. Also the ages will be added.

The average age can be calculated by dividing the total age of all persons from the number of members. So, formula will be

AverageAge = SumAge / Fam_Size

Next loop will run as many times as number of family members. Inside this loop state array will be check to see if it has value ‘Texas’. If so, the corresponding name array value will be printed.

Example input/output below:

*Entry in bold are user input

·  Enter family member name: Bob

·  Enter family member age: 25

·  Enter family member state: New York

·  Enter family member name: Jack

·  Enter family member age: 55

·  Enter family member state: Texas

·  Enter family member name: Mark

·  Enter family member age: 50

·  Enter family member state: Texas

·  Enter family member name: Paul

·  Enter family member age: 18

·  Enter family member state: New York

·  Enter family member name: Rick

·  Enter family member age: 23

·  Enter family member state: Texas

·  Enter family member name: Amy

·  Enter family member age: 61

·  Enter family member state: Texas

need to show them entering the sentinel value

Fam_Size = 6

Average Age = 38.6666666667

Members who lives in Texas

Jack lives in Texas

Mark lives in Texas

You have not given any of the required formulas. Look at Hints for Final Project to see what was needed

Array data:

·  Name [0] = Bob

·  Age[0] = 25

·  State[0] = “New York”

·  Name [1]= Jack

·  Age [1]=55

·  State [1]=Texas

·  Name [2]= Mark

·  Age [2]=50

·  State [3]=Texas Name [0] = Paul

·  Age[3] = 18

·  State[3] = “New York”

·  Name [4]= Rick

·  Age [4]=23

·  State [4]=Texas

·  Name [5]=Amy

·  Age [5]=61

·  State [5]=Texas

Calculating Average Age:

·  Fam_Size = 6

·  SumAge = Age[0] + Age [1] + Age [2] Age[3] + Age [4] + Age [5] = 25+55+50+18+23+61 = 232

·  AverageAge = SumAge / Fam_Size = 232 / 6 = 38.6666666667

The way you show sumage being computed is not a way the computer can do it. Need to have a loop and add a single element from the array on each loop iteration

Printing those who live in Texas

Loop from i=0 to Fam_Size = 0

So where is the formula for this?

If State[i] = “Texas”

you have the assignment operator where you need the quality relational operator

Display Name[i], “lives in Texas”

End if

Just some warning. If you do it this way, printing as soon as you find a Texan, that is a fundamental violation of modular programming concepts, and you will lose a lot of point next week. What you need to do is assign the name of the Texan to a variable. Need a formula for that

Another warning for next week is that Display is not a valid instruction. Need to use Write’

Yet another warning for next week is that saying “lives in Texas” after each name give cluttered hard to read output. Just say, before the loop, the following people live in Texas, then have only the name, 1 name per line

End For

·  State[1] is equal to Texas thus:

·  WRITE Name[1] “lives in Texas”

·  State[2] is equal to Texas thus:

·  WRITE Name[2] “lives in Texas”

Variables Used:

Sr. No. / Variable Name / Default Value / Description / Data Type / Module/Subprogram Referenced
1.  / MAX_PERSONS / 100 / MAX_PERSONS is maximum array size (User can enter details of 100 members). / Integer / Main
2.  / Fam_Size / 0 / integer number of family members names input / Integer / Input, Process, Output
3.  / Name / 100 / array to store names of family members / String / Input, Output
4.  / Age / 100 / array to store ages of family members / Integer / Input, Process, Output
5.  / State / 100 / array to store states of family members / String / Input, Output
6.  / AverageAge / 0 / store average age of family members / Integer / Process, Output
7.  / SumAge / 0 / store addition of ages of family members / Integer / Process
8.  / Index / 0 / Loop variable / Integer / Process, Output

variables go before the formulas where they are used, not here at the end

Default values are inappropriate here

MAX_PERSONS looks to be a named constant. That is a good practice to use with arrays, but a variable is variable, and a constant is not. MAX_PERSONS is a constant and should be identified as such

The Module/Subprogram reference is a design detail and is not appropriate in the analysis

When you say that the default value for the arrays is 100, you must be talking about the size of the arrays. But the size is something much different from the default value

Average_Age and Sum_Age should be float, not integer

Need a string variable to hold the names of the Texans

Analysis

1)  Is there a Problem description?

Yes

2)  Does analysis include a description of the required output? A description of the necessary input? Is the process for obtaining the output from the input adequately described?

The output and the input are described. A process is not adequately developed

3)  Have variable names and definitions been given, and are the names suitable and appropriate?

Yes, though there is no variable named to hold the names of the Texans found

4)  Have all necessary formulas and example calculations been provided?

Adequate formulas not provided. Sample calculations do show how the process works

5)  Will the analysis result in a design that efficiently and reliably meets the project requirements?

No

6)  Documentation of the analysis

Variables are in the wrong location in the analysis. The output description contains inappropriate references to the program and to actions. No formulas provided

(-60)

Project Plan

Your 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 function and subprogram calls and uses arrays. 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.

Note: We do not use Modules anymore, call them Subprograms. Yes, Main Module will stay the same.

This assignment will be done in two parts 2 with 4 components of your submission including:

Part 1.

•Program Description- A detailed, clear description of the program you are building.

• 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.

Additional details about the program you need to write:

1. Family sizes vary, however you should design to be able to enter at least 50 Family members.

2. Your program needs to determine how many family members were input. You cannot ask the user how many family members will be input

3. Your test cases should have at least 6 family members.

4. Be sure to separate some functionality into functions or subprogram. Having all functionality in the main module is not a good design.

5. Your analysis should consider how to indicate the family member entry is complete.

6. Carefully consider the best data type for each of your variables. (e.g. when to use Float versus Integers versus Strings)

Part 2

•Pseudocode •Provide pseudocode of your overall design that fulfills the requirements of the project

A. detailed pseudocode for each subprogram and function.

B. Add pseudocode comments with all major functionality and most minor functionality commented

C. write in C code (optional, but recommended)

D. Provide C code, compile and run it, using any online C compiler (e.g ideone.com, codetwist.com).

• Show test plan covering all major functionality and most minor functionality. Multiple Input and expected output provided for most subprogram. Remember you need at least 6 sets of input data (Test data) along with their expected output for testing your program.

•Your test data can be presented in the form of a table as follows (note: feel free to adapt to your design)

Example application test data:

Test Case # Input Expected Output

1 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

2 Your input data Your expected output

3 Your input data Your expected output

Your completed assignment should be saved as Word document and submitted no later than the due date. Your document should be neat, well-written with minimal grammatical and spelling errors. Your document should contain page numbers at the bottom of each page. Use single space line formatting.

Hints for Final Project

Variables

Need three arrays, a string array for the names, a string array for the states, and an integer array for the ages

Need to specify the size of the array, and that it is an array in the analysis

Need integer variable to hold the number of family members entered

Need float variable to sum the ages, and to hold the average age

Look below at the two ways to get the names of the Texans. Based on which you choose you need either

a string scalar (a scalar is a variable that is not an array) that will hold the names of all of the Texans

a string array to hold the names of the Texans, and an integer variable that will hold the number of Texans found. If you use this approach, need to specify the size of the array

an integer variable to control the for loops you will use, and to serve as the index of the arrays when calculating the average age and generating the variable with the names of the Texans

Formulas in the analysis

You will need 3 formulas

Loading the arrays, and counting the number of family members input

Use the age array and the number of family members to calculate the average age (see details below)

use the name and state arrays, and the number of family members to generate either a string variable with the names of all of the Texans, or an array of strings with the names of all of the Texans

Do not output the name of a Texan when found, place in a variable

Loading the arrays

Cannot ask the user how many family members will be loaded

Use a sentinel loop to input family members, with the sentinel value being based on the name. Typically, the sentinel value is a name of *

Need to count the number of family members input and return this value for use later

Do not sum the ages while inputting them. This will be different from HW3