Professional Documents
Culture Documents
There was a proud Country by the name of WOLMERS which consisted of six (6) states namely: BARROWS, COWPER, FORBES,
MURRAY, HOLLAR and HOWSON. Annually each state conducts a SPORTS DAY within each state. Yearly the state representative
must provide a budget forecasting and showing actual financial information relating to the event which is send to the Chief Event
Coordinator of the country. Develop an algorithm that will accept and store the name, the total actual expenditure and total projected
expenditure for each state.. No more than # states should be accepted. The algorithm should also determine if the status for each state is a
surplus, deficit, or breakeven. Additional algorithm should determine the number of states with a deficit, and finally produce a report from
the data collected.
PSEUDOCODE SOLUTION
START
DECLARE count AS INTEGER
DECLARE deficit AS INTEGER
DECLARE state AS STRING ARRAY OF SIZE 6
DECLARE expenseP AS REAL ARRAY OF SIZE 6
DECLARE expenseA AS REAL ARRAY OF SIZE 6
DECLARE balance AS REAL ARRAY OF SIZE 6
DECLARE status AS STRING ARRAY OF SIZE 6
FOR count = 1 TO 6 DO
PRINT Enter the name of the State
READ state[count]
PRINT Enter the Projected Expense
READ expenseP[count]
PRINT Enter the Actual Expense
Page 1 of 14
READ expenseA[count]
ENDFOR
FOR count = 1 TO 6 DO
balance[count] expenseP[count] expenseA[count]
ENDFOR
FOR count = 1 TO 6 DO
IF ( balance[count] > 0) THEN
status[count] SURPLUS
ENDIF
IF ( balance[count] < 0) THEN
status[count] DEFICIT
ENDIF
IF ( balance[count] = 0) THEN
status[count] BREAK-EVEN
ENDIF
ENDFOR
deficit 0
FOR count = 1 TO 6 DO
IF(status[count] = DEFICIT) THEN
deficit deficit + 1
ENDIF
ENDFOR
PRINT FINANCIAL INFORMATION REPORT ON EACH STATE OF WOLMERS
PRINT STATE NAME
ACTUAL EXPENSE
PROJECTED EXPENSE
STATUS
FOR count = 1 TO 6 DO
PRINT state[count], , expenseA[count], ,expensesP[count], , status[count]
ENDFOR
PRINT THE NUMBER OF STATES THAT HAVE A DEFICIT STATUS IS:, deficit
STOP
Page 2 of 14
STATE
Cowper
Forbes
Howson
Murray
Hollar
Barrows
PROJECTED EXPENSE
ACTUAL
EXPENSE
$15,000.00
$11,000.00
$20,000.00
$9,000.00
$15,000.00
$10,000.00
$10,000,00
$14,000.00
$20,000.00
$10,000.00
$9,000.00
$10,000.00
Page 3 of 14
TRACETABLE (PG 1)
Deficit
Count
State
expenseP
expenseA
Balance
Status
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
0
1
Cowper
0
2
Cowper
Forbes
0
3
Cowper
Forbes
Howson
0
4
Cowper
Forbes
Howson
Murray
0
5
Cowper
Forbes
Howson
Murray
Hollars
15000
15000
11000
15000
11000
20000
15000
11000
20000
9000
15000
11000
20000
9000
15000
10000
10000
14000
10000
14000
20000
10000
14000
20000
10000
10000
14000
20000
10000
9000
Output
Page 4 of 14
0
6
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
TRACETABLE (PG 2)
Deficit
Count
State
expenseP
expenseA
Balance
Status
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
0
1
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
0
2
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
3
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
0
4
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
Output
Page 5 of 14
0
5
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
6
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
TRACETABLE (PG 3)
Deficit
Count
State
expenseP
expenseA
Balance
Status
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
0
1
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
0
2
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
3
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
4
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
5
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
6
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
DEFICIT
DEFICIT
SURPLUS
DEFICIT
SURPLUS
BREAK-EVEN
Output
Page 6 of 14
TRACETABLE (PG 4)
Deficit
Count
State
ExpenseP
ExpenseA
Balance
Status
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
0
1
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
1
2
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
1
3
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
2
4
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
2
5
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
2
6
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
DEFICIT
SURPLUS
DEFICIT
SURPLUS
DEFICIT
SURPLUS
Output
Page 7 of 14
DEFICIT
SURPLUS
DEFICIT
SURPLUS
DEFICIT
SURPLUS
TRACETABLE (PG 5)
Deficit
Count
State
ExpenseP
ExpenseA
Balance
Status
Output
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
0
1
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
2
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
3
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
4
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
5
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
0
6
Cowper
Forbes
Howson
Murray
Hollars
Barrows
15000
11000
20000
9000
15000
10000
10000
14000
20000
10000
9000
10000
5000
-3000
0
-1000
6000
0
SURPLUS
DEFICIT
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
BREAK-EVEN
FINANCIAL
FORBES,
11000,
14000,
SURPLUS
HOWSON,
20000,
20000,
BREAK-EVEN
MURRAY,
9000,
10000,
SURPLUS
HOLLAR,
15000,
9000,
DEFICIT
BARROWS,
10000, 10000,
BREAK-EVEN
DEFICIT
SURPLUS
INFORMATION
REPORT ON EACH
STATE OF WOLMERS
DEFICIT
SURPLUS
DEFICIT
SURPLUS
NAME
ACTUAL EXPENSE
PROJECTED EXPENSE
STATUS
Cowper, 15000,
10000, DEFICIT
Page 8 of 14
DEFICIT
SURPLUS
DEFICIT
SURPLUS
DEFICIT
SURPLUS
THE NUMBER
OF STATES
THAT HAVE A
DEFICIT
STATUS IS: 2
END;
FOR count := 1 TO 6 DO//This loop is to determine if the state has a SURPLUS, DEFICIT or BREAK-EVEN
BEGIN
IF balance[count] > 0 THEN
status[count] := 'SURPLUS';
IF balance[count] < 0 THEN
status[count] := 'DEFICIT';
IF balance[count] = 0 THEN
status[count] := 'BREAK-EVEN';
END;
deficit := 0;
FOR count := 1 TO 6 DO// This loop is to count the number of states in DEFICIT
BEGIN
IF status[count] = 'DEFICIT' THEN
deficit := deficit + 1;
END;
CLRSCR();// This is to CLEAR the SCREEN
WRITELN('_________________________________________________________________________');
WRITELN('_________________________________________________________________________');
WRITELN('
A FINANCIAL REPORT ON THE STATES OF WOLMERS');
WRITELN('_________________________________________________________________________');
WRITELN('_________________________________________________________________________');
WRITELN('STATE NAME
PROJECTED EXPENSE
ACTUAL EXPENSE
STATUS');
WRITELN('_________________________________________________________________________');
FOR count := 1 TO 6 DO//This loop is outputting the content of the arrays
BEGIN
WRITELN(state[count],'
', expenseP[count]:5:2,'
',status[count]);
WRITELN('-------------------------------------------------------------------------');
END;
',expenseA[count]:5:2,'
Page 11 of 14
COMPILATION
Evidence that program compiled without errors
Page 14 of 14
DATA INPUT
INPUT DATA
Page 15 of 14
OUTPUT SCREEN