Question: GMail .0000 4:11 PM deanza.instructure.com b.) (Lab5b.cpp) Write a program named Lab5b.cpp. This program reads expense data from a file in a predefined format and
GMail .0000 4:11 PM deanza.instructure.com b.) (Lab5b.cpp) Write a program named Lab5b.cpp. This program reads expense data from a file in a predefined format and produces an expense report. Follow the steps described here to complete the program. Collecting Data From The Data File Define a named constant for the size of the arrays. For example, const int NUM-DAYS = 7; Define an array of strings for the days and an array of doubles for the expenses using the named constant as the array size. Courses Initialize the array of doubles with 0.0, not 0. Each day in the array of days corresponds to the expense in the same position in the array of expenses Check. The arrays have been defined using meaningful identifiers. Calendar Inbox Check. The arrays have been defined using the named constant as the array size. Check. The array of doubles have been initialized with 0.0. Define a named string constant for the file expenses.txt which was created by lab3a. You may also create the expense file by hand using a text editor Help Open the file using the named string constant. Read the data from the expense file into the arrays. The code for reading the expense records should not assume there are exactly seven records in the file. Use a counter variable to keep track of the number of records received from the file. Other than reading and counting the number of expense records, don't do any data processing and reporting at this step. Close the file. Check. The number 7 is not used in any form in the process of reading the file Check. No calculation for total, average, and largest at this step. Check. No reporting at this step. Check. File is closed. Process Data K
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
