Preview

Array: Mathematics and Family Members

Good Essays
Open Document
Open Document
617 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Array: Mathematics and Family Members
This program will let the user enter all the names of their family members, the ages of those family members, and their state of residence. The program will display the average age of all family members input, and also display the names of any family members that live in Texas. We will create three separate arrays; one for the names of the family members, another for their ages, and the third will be for their state of residence. We'll first ask the user to enter the number of family members he has (we will limit this to a max of 25); this will allow us to determine how large of arrays we will need to create to store the data. We'll call this variable Size. After inputting all names, ages, and states of residence the data will all be stored within the arrays. The program will identify those family members who reside in Texas, and also display their names on the screen. This will be done by creating a loop that will review all the entries from the names and residencies arrays, compare the state to the string "Texas," and print that corresponding name. The average age will be calculated by also looping through the values in the age array, calculating the collective sum, then (as stated earlier) dividing by Size.

Necessary Calculations
The variable AvgAge (declared as Float) will be used in order to calculate the average age. A loop will go through each value of the Ages array, keep a running total sum, then divide that total by the variable Size to get the average age.
//NOTE: I use Float instead of Integer because there is a possibility of losing a trailing decimal if //numerical data is calculated as an Integer.
AvgAve = sum of all ages Size
So for example, if 13 family members are entered and the sum of all their ages is 169, AvgAge would equate to 13.

What is the required output?
Output to the screen will include: • The average age of all the user's input; and • The names of family members that reside in Texas.

What is the

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Nt1310 Unit 3 Maths

    • 552 Words
    • 3 Pages

    When addition or subtraction is performed, answers are rounded to the least significant decimal place.…

    • 552 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    ElizabethFlaimFP

    • 1289 Words
    • 7 Pages

    Problem Definition: Design a program that allows a user to input a list of family members, along with their age and the state where they live. The program will determine and print the average age of the user’s family. The program will also print the names of any family member that lives in Texas. The program design should also allow the user to enter at least 50 family members.…

    • 1289 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    Chapter 8 Problem 1

    • 175 Words
    • 2 Pages

    Analysis: The problems required output is the students name with scores from three tests. Each student and scores shall be listed on separate lines. The input variables needed for this program include Test1, Test2, Test3, and Student.…

    • 175 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    * Line 11 keeps a sum of all the participant ages. To compute your participant average age, you must divide the sum of all your participants ages by the number of participants,…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Pt1420 Unit 3 Essay

    • 966 Words
    • 4 Pages

    4- Select two same age elderlies per gender. Select two same age adults per gender. Do the same with the Children.…

    • 966 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    C228 Task 1 WGU

    • 4743 Words
    • 16 Pages

    age twenty-five and up make up sixty-seven percent of the population of [city/county name] City…

    • 4743 Words
    • 16 Pages
    Powerful Essays
  • Good Essays

    Using our data set from Unit 1, compose a 3-page e-mail to the head of the American Intellectual Union, which includes the following:…

    • 297 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Case 2 Chem Med Company

    • 721 Words
    • 3 Pages

    r. Depending on how many decimal places you want to go out, but for all intents and purposes, their…

    • 721 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Hmc Portfolio

    • 326 Words
    • 2 Pages

    2Notice that Exhibit 6 reports only one decimal and so you should _nd the second…

    • 326 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    In the county the population was spread out with 22.90% under the age of 18, 12.80% from 18 to 24, 34.80% from 25 to 44, 19.80% from 45 to 64, and 9.70% who were 65 years of age or older. The median age was 32 years. For every 100 females there were 93.00 males. For every 100 females age 18 and over, there were 89.70 males.…

    • 412 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Family Analysis Project

    • 1477 Words
    • 5 Pages

    Both Jane and John are working full time during the days, while Tom is responsible for household chores and is searching and applying to get into med school. They can be considered to be at the working middle class in the socioeconomic scale. The family is very…

    • 1477 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    When To Use Each Test

    • 330 Words
    • 2 Pages

    Analyze, compare means, gives you a window with variables, move over appropriate variable (age), put in whatever value…

    • 330 Words
    • 2 Pages
    Satisfactory Essays
  • Best Essays

    2. The average age of each fleet was calculated by first multiplying the total number of calendar days each aircraft has been in service at that time.…

    • 1625 Words
    • 5 Pages
    Best Essays
  • Better Essays

    The values given in parentheses (if provided) are not standard and may not be exact…

    • 2550 Words
    • 19 Pages
    Better Essays
  • Good Essays

    I interviewed a total of 25 account holders of the Bank and checked their profession. From the above table ( tabe-1) , it shows that majority of the respondents belong to business group and this is 36%. The next group close to business group is service holder and their percentage is 32% which also seems significant. Only 8% of the respondents belong to student group. 24% of the respondents came from different entities which include housewives, retired officers and those who are getting money from overseas. The results clearly indicate that Bank has been able to attract business people and service holders to open the account. This suggests that Mutual Trust Bank concentrates to bring these group of people under their umbrella through advertise and promotion,…

    • 770 Words
    • 4 Pages
    Good Essays