Assume that your family has 10 members. Assume further that each family member has a certain amount of savings. Your task is to determine: (a) the total amount of savings that the family has, as a whole and (b) to determine who has the largest savings. To solve this problem:


a. Show the pseudocode declarations needed to declare two arrays - one an array which contains the names of the family members, and the other an array which contains the savings (i.e. money) held by each family member. The arrays are parallel arrays because the savings shown in the second array for a certain array position are the savings for the family member whose name appears in the same position in the first array.

b. Write a function, which is called from the main module - this function will determine and return the total savings.

c. Write a function also called from the main module - this function will determine and return the array index containing the largest savings. Your main program should then print the name of the person who holds those savings, as well as the amount

What have you done so far?

Pseudocode

Step 1: Take an two dimensional array of character for holding names, another array say sav of float type for holding savings .
Names Sav
Dorothy 66.555.00
Barbara 78,895. 50
Diane 50,000.00
Patricia 42.000.00
Lynette 22,000.10
Lenora 22,000.12
Sandy 32,000.00
Connie 12.000.00
Tatanisha 10,000.00
Diamond 690.00
Declare Names (10) as integer
Declare Savings, Total as Float
Declare K as integer
Set Sum = 0
For (K = 0; K<10; K++)
Write “Enter savings for Dorothy” + (K+1)
Input Savings
Step 2: With the help of for loop enter the values in both the arrays at same and corresponding index numbers
Declare Names (10)

Good start!

you may want to organize the pseudocode according to your teacher's specifications. Here are some hints.

Declaration
The instructions for part (a) requires 2 arrays, one for the family members and the other for savings.
They are parallel meaning that:
if names(4) contains Dorothy,
then savings(4) contains Dorothy's savings.
Initialization
These two arrays must be declared (but empty) in the main program. Some how they must be initialized, i.e. values put into them. This can be done by repeated interactive input as you suggested (Enter name:... Enter savings...), or by initialization of the array as stored input. You can clarify through your class notes or your teacher to see if there is a preference.

Method (b) total savings
You will need a function that returns the total from the given array.
Typically the function will be given the two arrays, AND the size of the array (10 in this case) so it will calculate the total savings and return the total as a value. You have a good skeleton of doing this: declaring total as a float, initialize it to zero, and then add the n(=10) savings to total using a for loop. Finally return the total as a value.

(c) function for maximum.
It is similar to (b), except that the total will be replaced by another variable called maxSavings. For each family member's saving, you would compare with maxSavings. If the family member's saving is greater, then maxSavings will be replaced by the current savings. By the end of the for-loop, maxSavings will contain the maximum. This value will be returned to the calling (main) function.

If you need clarifications, please post.
Feel free to post your revised pseudocode for comments.

To solve this problem, we will use parallel arrays to store the names and savings of each family member.

a. Pseudocode declarations for the arrays:

```
Declare an array called familyNames with size 10 // to store the names of the family members
Declare an array called savings with size 10 // to store the savings of each family member
```

b. Function to determine the total savings:

```
Function calculateTotalSavings()
totalSavings = 0
For i = 0 to 9
totalSavings += savings[i]
End For
Return totalSavings
End Function
```

c. Function to determine the index of the largest savings:

```
Function findLargestSavingsIndex()
largestIndex = 0
For i = 1 to 9
If savings[i] > savings[largestIndex] Then
largestIndex = i
End If
End For
Return largestIndex
End Function
```

To print the result and execute the program:

```
Declare and initialize the familyNames array with the names of the family members
Declare and initialize the savings array with the savings amount of each family member
totalSavings = calculateTotalSavings()
largestSavingsIndex = findLargestSavingsIndex()

Print "Total savings of the family: " + totalSavings
Print "The person with the largest savings is " + familyNames[largestSavingsIndex] + " with an amount of " + savings[largestSavingsIndex]
```

Make sure to replace the placeholder values with actual names and savings amounts when implementing the code in your preferred programming language.