Hello,
I am learning to do pseudocode. I have typed out my code and gone over it a couple of times. I just want someone to double check that I am not missing anything. I have run the basic program through raptor and the logic seems to be sound.
Thank you,

Project: You will solve a calculating task with the following requirements.
* You will ask the user the type of operation he wants to do.
1- addition,
2- 2-multiplication,
3- 3- comparison,
4- 4- Read names and ages from file for a limited number of times or until the end of file, -1- end of program.
You must implement a loop which will end by -1 from user input.


Module Main ( )
//This is the main module that will ask the user what operation they would like to do.
//Declare variables
Declare real operation
Declare real sum
Declare real counter
Declare integer index
Declare integer number
Declare real product

//Declare Function Calls
Call Add(sum, counter, index, num[ ])
Call Multiply(product, counter, index, number)
Call Compare(largest, smallest, index, counter)
Call ReadNamesAges(name, age, MyFile, MyOut)

//Set variables
Set sum = 0
Set index = 0
Set counter = 1
Set product = 1
Set number = 1

//Put all information gained into output file named MyOut.txt
Open MyOut

//Set Loop
// Ask the user the type of operation he wants to do.
Display “What type of operation would you like to do? Choose 1- for addition, 2- for multiplication, 3- for compare, 4- pulling friends names and ages from a file, and -1 to end the program.”
Input operation
For operation<4 or operation == -1
If operation == -1
//End program if -1 is entered.
Else
If operation == 1
//Send to module Add.
Call Add(sum, counter, index, num[ ])
Else
If operation == 2
//Send to module Multiply.
Call Multiply(product, counter, index, number)
Else
If operation == 3
//Send to module Compare.
Call Compare(largest, smallest, index, counter)
Else
If operation == 4
//Send to module ReadNamesAges.
Call ReadNamesAges(name, age, MyFile, MyOut)
Else
//If user did not enter 1,2,3,4 or -1 then display message for them to enter correct operation.
Display “That is not an operation option. Please enter 1,2,3,4 or exit with -1.
End If
End If
End If
End If
End If
End For
//Close MyOut.
Close MyOut

End Module

Module Add(real ref sum, real ref counter, real index, integer num[ ])
//This module is for asking the user for a couple of integers to add.

//Declare variables
Declare integer num[ ]

Display “How many numbers do you wish to add?”
Input index
//Set Loop
While index > counter
//Enter the integers you will be adding.
Display “Enter your” +counter+ “number.”
Input number[counter]
//Get the sum of all the numbers when added together.
Set sum = sum + number
//Set the loop to only run once for each integer given.
Set counter = counter +1
End While
//Display the final sum of all numbers added together.
Display “The sum is “ +sum
End Module

Module Multiply(ref integer product, real ref counter, real index, integer number)
//This module is for asking the user for a couple of integers to multiply.
Display “How many numbers do you wish to multiply?”
Input index
//Set Loop
While index > counter
//Enter the integers you will be multiplying.
Display “Enter your” +counter+ “number.”
Input number
//Get the sum of all the numbers when multiplied together.
Set product = product*number
//Set the loop to only run once for each integer given.
Set counter = counter +1
End While

//Display the final sum of all numbers multiplied together.
Display “The final product is “ +product

End Module

Module Compare(integer largest, integer smallest, real counter, real index)
//This module asks the user the number of integers to compare, and finds the largest and smallest integer from the input.

//Declare values
Declare integer largest
Declare integer smallest
Declare integer num[ ]

//Set the largest and smallest. Set the largest to -5000 so that any number larger than that will then become the largest when compared in the loop. Set the smallest to 5000 so that any number smaller than that will then be set to the smallest in the loop.
Set largest = -5000
Set smallest = 5000

//Get constant for array size.
Display “How many numbers do you wish to compare?”
Input index

//Set Loop
While index > counter
//Enter the integers you will be comparing and set array.
Display “Enter the integer numbers you wish to compare.”
Input num[counter]

//Get the largest integer.
If num[index]> largest
Set num[index]==largest
Else
//Get the smallest integer.
If num[counter]<smallest
Set num[index]==smallest
End If
End If
//Set the loop to only run once for each integer given.
Set counter = counter +1
End While

//Which number is largest
Display “The largest number entered is “ +largest

//Which number is smallest
Display “The smallest number is “ +smallest

End Module

Module ReadNamesAges(string name[ ], real age[ ], InputFile MyFile, OutputFile MyOut)
//This module pulls names and ages from another file.

//Declare variables
Declare string name[ ]
Declare real ages[ ]
Declare InputFile MyFile
Declare OutputFile MyOut

//Set counter.
Set counter =0

//Ask user to enter how many people they would like to extract from the file.
Display “How many people would you like to look up?
Input index

//Open the file.
Open MyFile

//Open my output file.
Open MyOut

//Set loop to go for as many times as user wishes or until end of file. There are 10 names and ages in MyFile, so the file max is 10.
For index>counter or index<10
//Set array and get names from file.
Display “The names of people in the file.”
Input name[index]

//Display the names of the people the user wants.
Display “This is the name of the person you requested.” +name[index]

//Display the ages of the people listed.
Display “These are the ages of the people in the file.
Input ages[index]

//Display the ages of the people in the file.
Display “This is the age of the person you requested: “ +ages[index]

//Set counter to end loop.
Set counter = counter+1

End For

//Close files.
Close MyFile.
Close MyOut.

End Module