Objectives ~ code, compile and run a program containing ARRAYS ~ correctly reference and manipulate data stored in an

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Objectives ~ code, compile and run a program containing ARRAYS ~ correctly reference and manipulate data stored in an

Post by answerhappygod »

Objectives
~ code, compile and run a program containing ARRAYS
~ correctly reference and manipulate data stored in an
array
~ output data in readable format
Assignment
Plan and code a modular program utilizing arrays.
Write a complete modular program with 3 functions
(input, calculate, output) to calculate the total amount
of expenses and total amount of income for H.C. Advertising.
All data will be input from a file (see below).
1) In the input module, Input data and error check
data. Store Income ( I ) amounts in InArray and Expense (E)
amounts in ExArray. If any data record contains an error,
output the data to an error file with a message indicating what
caused the error. Do not store error data in any array.
2) In the calculate module accumulate the total amount of
values for that given array. Call the calculate module once
with InArray and once with ExArray.
3) In the output module, output the contents of each array and
the total amount of that array to an output file. Call the
output module once with InArray and once with ExArray.
Input
Input data from a file ("HCIn.txt"). Create the
data file below using your text editor or Notepad. One record of
data contains the following sequence of data:
987
E
5.50
236
I
95.00
824
I
15.75
Where
987
Account number
E
Expense
I
Income
5.50
Expense or income amount
Data File
987
E
5.50
236
I
95.00
824
I
15.75
419
E
275.95
013
E
129.43
238
I
12.31
101
I
100.10
879
E
52.45
444
R
9.90
654
I
23.45
786 I

-34.56
Output
In the output module, output the contents of each array and the
total of all values in that array, clearly labeled and formatted
for readability to a file ("HCOut.txt").
The output module must be a reusable module, calling it once with
InArray and once with ExArray.
Note
Adequately check entered data for validity. Use adequate test data
to process all valid data and representative data to verify that
your program handles invalid data appropriately.
Label all output clearly.
You may NOT use return or break or exit to prematurely exit
the program. Exit may only be used to check for correctly opened
files - nowhere else in any program. Break may only be used
in switch statements - nowhere else in any program.
No pointers. You may NEVER use goto or continue
statements in any program.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply