Monday, May 20, 2019
Program Design Essay
Your utmost project leave behind be to analyze, tar beat surface, and document a simple weapons platform that utilizes a good design exhibit and incorporates sequential, selection and repetitive scheduleming statements as well as at least unrivaled function cry (out) and the exercise of at least one order. The specific problem you remove to clobber for the final project is Design a program that provide intromit a exploiter to infix a list of your family fractions along with their board and state where they reside. Determine and ingrain the just age of your family and mark the names of anyone who live in Texas.1. Problem definition Design a program that give allow a drug 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 result be submitted next week.1 a) Write the problem statements as of what is engageed to solve this problem.autonomic nervous system1a)First, I must(prenominal) force a program that depart allow the user to scuttlebutt a list of their family members that impart 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.autonomic nervous system 1b)To begin with, I must first identify the input learning. From the problem definition, I gathered that I will have 3 types of input data and they ar 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 needto create a formula that will give us the flush output information.The sideline formula weed be apply to achieve the desired outputAverage Age of Family personifys the total of family members ages dual-lane 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 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 cast 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 parliamentary law to display the inp uts and outputs properly. My output variables, they will be AvegAgeFam to identify the Average age of the Family. This data will be set as botch 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. Im going to create a function that will output the Average age of the Family. Im 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 FloatSet AveAge = Total / CountWe must include loops in this program. The loops are going to be utilise 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. T here 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 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 cream 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 precious to display just one of the results, the user would have to do t he 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 substance to solve the aforesaid(prenominal) problem definition of family member in Texas. As you have learned, a ace problem can be solved in more than one guidance by exploitation different programming ready, 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 lord problem must re primary(prenominal) the same. I will also have to keep the same user inputs as well. Takin g a different approach in my pseudocode will make these changes possible.So for my second analysis, the user inputs will remain the same from the original problem. The Family members Age, State, and Name will still beused. However, this m we will build staffs 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 run 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 border 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 withstand 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 the family members ages divided by the number of family mem ber. 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 particular 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 spot 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.