$24
1. Problem Statement
Create a program that uses a three-dimensional array to calculate monthly
2. Requirements
2.1 Assumptions
User will only enter integers 1-12 for month
User will only enter y or n for loop choice
Command line input/output only
2.2 Specifications
Program will initialize 3 dimensional array with given data
3 dimensional array does not change
Decomposition Diagram
3 Dimensional Array Monthly Sales Program
Input
User input integers 1-12
User inputs char y or n
Process
Iterate into array to calculate
Output
Print formatted
Test Strategy
Valid Data
Invalid Data
5. Test Plan Windows Version
***All test cases appear the same in table for Linux, validated with screenshots.
Test Strategy
#
Description
Input
Expected Output
Actual Output
Pass/Fail
Valid Data
1
1-12 Month
6
Correct Month
Correct Month
Pass
Valid Data
2
Show another month
Y
Ask for month
Asked
Pass
Valid Data
3
Show another month
n
exit
exit
Pass
Invalid Data
1
Month < 1
-1
Ask to retry
Asked
Pass
Invalid Data
2
Month 12
13
Ask to retry
Asked
Pass
Initial Algorithm
Define Global Constants
Number of Departments 2
Number of Stores 2
Number of Months 12
Create Function printMonthlySales
Parameters and Returns
Sales Array, Month
Void
b.
MAIN FUNCTION
a. Create and Initialize 3 Dimensional array storeMonthlySales
{ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8,
3.9, 4.0, 4.1, 4.2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.1 }
Create 2 holder variables
One integer to hold month input
One char to determine continue/exit
Do until user enters ‘n’ to stop program
Give user month selection
1-12 Valid
Compute Totals
Print Table
Outside bounds invalid
Prompt user: “Would you like to insert more positive integers?”