# pseudocode

posted by .

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

• pseudocode -

What have you done so far?

• pseudocode -

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)

• pseudocode -

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.

## Similar Questions

1. ### English expression

How many are there in Mi-na's family? There are five in her family: her father, her mother, her older brother Min-su, her younger brother Min-ho, and her. How many people are there in Mi-na's family?
2. ### Basic Algebra

\$5130 is to be divided equally among the members of a family group. Eight members of the family obtained knowledge of the loot and insisted their share. Determine the original number of family members.
3. ### math

he pie chart below shows how the total annual income for a certain family is spent. If the amount budgeted for Housing and Insurance combined is 42,000, what is the total family income?
4. ### Health

what should you refrain from doing while helping a friend or family member who is being abused?
5. ### statistics

The pie chart below shows how the total annual income for a certain family is spent. If the total annual income is , what amount is budgeted for Savings and Insurance combined?
6. ### Math

The manager of the ice cream shop noticed that 90% of all club members brought along a family member who spent an average of \$18 in the shop. The tax on their bill was 5.5%.What was the total amount spent by the family members in one …
7. ### PreAp Math

The manager of the ice cream shop noticed that 90% of all club members brought along a family member who spent an average of \$18 in the shop. The tax on their bill was 5.5%. a. What was the total amount spent by the family members …
8. ### MATH CLASS 6th grade

The manager of the ice cream shop noticed that 90% of all club members brought along a family member who spent an average of \$18 in the shop. The tax on their bill was 5.5%. a. What was the total amount spent by the family members …
9. ### MATH CLASS 6th grade

Every month the Incredible Ice Cream Shop sends a card with a coupon for a free ice cream treat to the members of their ice cream club who were born in that month. The manager of the ice cream shop noticed that 90% of all club members …
10. ### MATH CLASS 6th grade

Every month the Incredible Ice Cream Shop sends a card with a coupon for a free ice cream treat to the members of their ice cream club who were born in that month. The number of members and their birthday month is shown below. Month …

More Similar Questions