Program Design

Custom Student Mr. Teacher ENG 1001-04 1 March 2016

Program Design

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 live in Texas.

1. Problem definition: 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 live in Texas. Note: Your pseudcode, flow-chart and test cases will be submitted next week.

1 a) Write the problem statements as of what is needed to solve this problem.

Ans 1a)First, I must create a program that will allow the user to input a list of their family members that will include their age and state of residence. The program will also compute and print out the average age of the family as well as print out the names of every family member that resides in the state of Texas.

1 b) Write your analysis of the problem and the design approaches that you will take to solve this problem.

Ans 1b) To begin with, I must first identify the input information. From the problem definition, I gathered that I will have 3 types of input data and they are: Family Members Names, Age, and State of Residence. The output data will consist of the average age of all the members of the family. Also I need an output printout of each family member that reside in Texas. Therefore, in my program I must be able to allow the user to input the information needed to calculate the average age of the family. To compute the output, I need to create a formula that will give us the correct output information.

The following formula can be used to achieve the desired output:

Average Age of Family equals the total of family members ages divided by the number of family members Family that lives in Texas = Show the names of all family members IF they live in Texas

To begin my design, I need to establish the variables that will control both our input information and output data. For my input data, I will use Name to identify the family members name. Name will be set as String Array data. I will use StateRes to identify the state of residence for each family member. StateRes will also be set as String Array type data. I will use AgeOfMem to recognize the family members age and it will be set as an Integer Array data type. To get all of this information in a table format, I will have to create an array in order to display the inputs and outputs properly. My output variables, they will be AvegAgeFam to identify the Average age of the Family. This data will be set as Float due to the fact that an average number could quite possibly be a decimal value. So to represent the output of showing all family that live in Texas, I will use ResOfTexas as a String data type. Now to answer meet the requirements of this assignment, I must create a function. I’m going to create a function that will output the Average age of the Family. I’m going to utilize the Count function so we can also total and display how many family members live in Texas. Included will be the names of the function.

The following formula will represent our Count function: Function AveAge (Age, Total, Count) As Float

Set AveAge = Total / Count

We must include loops in this program. The loops are going to be used to prompt the user to enter the information until the user is done. The Count function will be used to help calculate the Average Family Age. There will also be an IF element added to help the program figure out the family members that live in Texas.

1 c) Write the assumptions and limitations and how they will be handled in your project.

Ans 1c) In my project, there are numerous assumptions and limitations that are being handled in the pseudo code. First of all, this program is only designed to calculate the average age of all the family members that the user will input. There is no other calculation that the program has been designed to do. Secondly, the program does not give the user any option or chance to return to inputting more family members if they forgot to do so at the beginning. This program was not designed to have a set limit to how many inputs the user could enter. This list could keep going on and on. This program is created to calculate and display both the Average age of family Members and the residents who live in Texas. If the user wanted to display just one of the results, the user would have to do the whole program just to get one of the results. This is being handled by the pseudo code only being able to handle the calculations that are set. The user does not have the ability to let the program know how many family members will be entered before the user begins. To handle that, the Count function is being used in the psuedocode to obtain the correct output.

1 d) Provide an alternative analysis and design approach showing a different way to solve the same problem definition of family member in Texas. As you have learned, a single problem can be solved in more than one way by using different programming construct, by choosing different logics etc. Tell us a different way of solving the same problem.

Ans 1d)  Now I must come up with an alternate design. I will have to make sure that my even though my design will change, the output of the original problem must remain the same. I will also have to keep the same user inputs as well. Taking a different approach in my pseudocode will make these changes possible.

So for my 2nd analysis, the user inputs will remain the same from the original problem. The Family members Age, State, and Name will still be used. However, this time we will build modules to be able to call up data when needed. We will have to call out subprograms in order to obtain the results we desire.. To begin with, we need to start with a Main module. This module is where the entire program is operated out of. It’s also where the user input is entered in. The main module is the head of all of the modules that will be discussed next. I will also create call modules under the main module that will be set up to calculate the average age of the family members and to print out the names of those living in Texas. Next I will create the second module which is the Call Module. This module will hold the calculations to compute the average age of all the family members that the user enters. Finally, I will need to build a results module. In this module, the user-entered family names will be used as input data. On the other hand, the output will only be those names of the family who live in Texas. This process will be conducted when we put an a IF statement within the module.

Now I will construct my new design. So, just like the design before, I need to declare my variables. The variables will and should be the same due to the fact that the desired output has not changed. Therefore my declared variables will consist of the following: Declare Name As String Array, Declare StateRes As StringArray, Declare AgeOfMem As Integer Array, Declare AveAgeFam As Float, Declare ResOfTexas As String, and Declare Count As Integer.

Calculations Module

In this module, will use the formula that was used earlier in the first design. It is this formula that will compute the average age of the family. The average age will be determined by the sum of all the family members’ ages divided by the number of family member. Therefore if Count was equal to 2 and AgeOfMem [0] was equal to 16, and Age [1] = 20. So the AveAgeFam was equal to AgeOfMem[0] + Age[1] divided by Count This would be a total of 16 + 20 / 2 = 18.

Finally, I would need to come up with a way for the names of members who live in Texas to be printed out. The psuedocode would use the StateRes array data type to search for the user input of “Texas”. Then, it would display the names associated with that particular element. So if State[1] was equal to Texas, then any name such as: Name[1]=James inside the name array would be printed. Therefore, the output would look like this: “James”. This modular design would be an alternate way to complete the same results and output as originally described in the first example. The major pieces of this design consists of the arrays, modules, functions, and the loops. This will provide us with the outputs that are required from the initial questions asked.


  • Subject:

  • University/College: University of California

  • Type of paper: Thesis/Dissertation Chapter

  • Date: 1 March 2016

  • Words:

  • Pages:

We will write a custom essay sample on Program Design

for only $16.38 $12.9/page

your testimonials