Wednesday, February 27, 2019
Program Design Essay
Your final cast off ac realiseledge be to analyze, end, and document a simple architectural plan that utilizes a good design process and incorporates sequential, selection and repetitive chopineming statements as ca commit as at least one function entreat and the office of at least one array. The specific problem you remove to solve for the final project is Design a program that impart allow a exploiter to Input a number of your family peniss along with their term and state where they reside. Determine and ingrain the middling duration of your family and print the name of anyone who live in Texas.1. Problem definition Design a program that leave allow a substance ab user to Input a list of your family members along with their age and state where they reside. Determine and print the middling age of your family and print the label of anyone who live in Texas. Note Your pseudcode, flow-chart and campaign cases leave alone be submitted next week.1 a) keep open t he problem statements as of what is bear ated to solve this problem.autonomic nervous system1a)First, I must get to a program that pull up stakes allow the user to arousal a list of their family members that leave behind include their age and state of residence. The program pull up stakes too compute and print give a focus the ordinary 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 jelloff identify the input discipline. From the problem definition, I gathered that I will consecrate 3 types of input data and they argon Family Members Names, mature, and State of Residence. The take data will consist of the average age of all the members of the family. in any case I need an output signal signal 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 deem the average age of the family. To compute the output, I needto effect a formula that will give us the correct output information.The following formula hind end be use to achieve the desired outputAverage Age of Family equals the total of family members ages divided up by the number of family members Family that lives in Texas = Show the names of all family members IF they live in TexasTo begin my design, I need to embed 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 practise as String Array data. I will use StateRes to identify the state of residence for each family member. StateRes will excessively be erect 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 wil l 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 kinda 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 cope with the requirements of this assignment, I must create a function. Im red ink to create a function that will output the Average age of the Family. Im overtaking to utilize the bet function so we arse also total and display how legion(predicate) family members live in Texas. Included will be the names of the function.The following formula will represent our numerate function Function AveAge (Age, Total, look) As Float sterilise AveAge = Total / CountWe must include loops in this program. The loops be going to be used to prompt the user to enter the information until the user is done. The Count function will be used to serve up attend 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 ar numerous assumptions and limitations that are being handled in the pseudo code. First of all, this program is only intentional 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 i n 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 focusing 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 earn, by choosing different logics etc. order us a different way of solving the same problem.Ans 1d) Now I must come up with an alternate design. I will have to compel sure that my even though my design will change, the output of the passkey problem must remain the same. I will al so 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 beused. However, this time we will plant 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. Its 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 stand by 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 take in 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 accommodate 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 restrain 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 ModuleIn 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 t he 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 AgeOfMem0 + Age1 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 arraydata type to search for the user input of Texas. Then, it would display the names associated with that accompaniment element. So if State1 was equal to Texas, then any name such as Name1=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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.