Posted by Anonymous on Saturday, March 3, 2012 at 6:24pm.
What have you done so far?
Step 1: Take an two dimensional array of character for holding names, another array say sav of float type for holding savings .
Barbara 78,895. 50
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)
Step 2: With the help of for loop enter the values in both the arrays at same and corresponding index numbers
Declare Names (10)
you may want to organize the pseudocode according to your teacher's specifications. Here are some hints.
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.
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.
English expression - How many are there in Mi-na's family? There are five in...
English expression - 1. How many are there in your family? 2. How many people ...
Math 10 Linear Equations - Kevin opened a bank account and plans to deposit $200...
healt - Consider this scenario: Deana recently decided to start attending ...
mathematics - Consider the composition of a three-child family. Assume that a ...
English - Hi, I am preparing for a english ISU presentation where my job is to ...
science - Never found in nature uncombined? Alkali metals Alkaline Earth Metals ...
physical science - do not noramlly react with other elements? Alkali metals ...
Physical science - Never found in nature uncombined? Alkali metals Alkaline ...
Data managment math - 1:There are 7 seats in the family new van. if 4 of the 7 ...
For Further Reading