Program Test Procedures
Not what you're looking for?
Generate a set of test inputs and expected results for the Currency Conversion program.
Pseudocode:
Input: Arrays of Employee Name and Salary [1..N]
Output: MeanSalary, nSalaryAbove, nSalaryBelow
Uses: BubbleSort
Declaration:
Real TotalSalary, MeanSalary
Integer nSalaryAbove, nSalaryBelow, Count, i
Process Begin
//sort the Salary Array
Call BubbleSort(Salary[1..N])
//Find the Average
TotalSalary = 0
Count = 0
For i = 1 to N
Do
TotalSalary = TotalSalary + Salary[i]
Count = Count + 1
Done
MeanSalary = TotalSalary / Count
//Find the number of salaries above or below the mean
nSalaryAbove = 0
nSalaryBelow = 0
For i = 1 to N
Do
If Salary[i] > MeanSalary
Then
nSalaryAbove = nSalaryAbove + 1
Else If Salary[i] < MeanSalary
Then
nSalaryBelow = nSalaryBelow + 1
End if
Done
//Output
Print "The Average Salary is ", MeanSalary
Print "The number of salaries above the Mean is ", nSalaryAbove
Print "The number of salaries below the Mean is ", nSalarBelow
Process End
Sub BubbleSort //Sorts the array in Ascending/Non-Decreasing Order
Input Array[1..N]
Output Sorted Array[1..N]
Declaration:
Integer Sorted //It's a flag to check if the Array is sorted
Integer k, i
Process Begin
//check if already sorted
Do //Begin the Sorting Loop
Sorted = True //Assume it is Sorted
For i = 1 to N-1
Do
If Array[i] > Array[i+1]
Then
Sorted = False
ExitLoop //Breaks out of this loop
End if
Done
If Sorted = True //The Array is already sorted, so End the Program
Then
End Sub
Else //Array needs to be sorted
//Go through the array once and swap the
For k = 1 to N-1
Do
If Array[k] > Array[k+1]
Then //Swap Array[i] with Array[i+1]
Temp = Array[i]
Array[i] = Array[i+1]
Array[i+1] = Temp
End if
Done
While True //End Do
Process End
Purchase this Solution
Solution Summary
This solution provides the learner with a set of procedures to be utilized for a computer currency conversion program.
Purchase this Solution
Free BrainMass Quizzes
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
C# variables and classes
This quiz contains questions about C# classes and variables.
Javscript Basics
Quiz on basics of javascript programming language.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.