I am having major problems with my c++ class because my professor rushes through the info and doesnt properly teach it. This is the project:
TASK: Write a program that reads an input file of deposits (doubles) being made to a bank, and stores them into an array (according to the specifications below). At the end of processing, display the
deposits.
Define a class called Deposit. The class definition should be in a separate file from your main
program, and the implementation should be separated from the interface. This class will have six
private data members: an array for the deposits, an index for the next available location in the
array, month, day, year, and “day of week” (such as “Monday”). (This array contains only the
deposits made on the same day.) This class will have public functions:
setDeposit - stores a deposit into the array, and prints a confirmation message to the
screen.
displayDeposits - prints out the entire array of deposits to a report file.
a constructor that uses a set function to initialize the Date to all 9's. (For example, day =
99.) The constructor also sets the index for the next available location in the array
to 0.
Processing logic: Create five objects, one for each workday of the week (Monday thru Friday.)
Have a loop read the input file of deposits. For each deposit, store it into the appropriate object
(using the method setDeposit), and print out the confirmation message (using that same method.)
At the end of processing, have displayDeposits for each object print out all the deposits in that
object. (displayDeposits in one object does not know about the other objects. Therefore, it
concerns itself with only its own object. Main should call this function for each object.) Note that
your call to displayDeposits should pass the output file by reference. (You can use either a
reference or a pointer.) This is to maintain a clear separation between your client code and the
class definition.
DATA VALIDATION: deposits must be greater than 0; Month must be in the range of 1 to 12; Day must
range from 1 to 31; and Year must be greater than or equal to 2000. (Do not concern yourself with
leap years, or with the correct number of days in a month Do not concern yourself with whether
there is more than one different Monday in the file, etc. You can choose whether main or
setDeposit validates the data.) If there is invalid data in a “record”, print the appropriate messages,
and discard the record. (It does not get added to the deposits for that day.)
SAMPLE INPUT:
The input file has all the deposits for the week (and for the one week only). At the beginning of
processing, you will create objects for each workday of the week (Monday thru Friday). Dates are
the first three inputs of each line, and simulate the mm/dd/yyyy format. The 4 input is the amount
th
of the deposit. As a simplification, for the purposes of this lab only, day modulus 5 provides the
day of the week, where 0 is Monday, 1 is Tuesday, etc. There are no deposits for Saturday and
Sunday, nor can Saturday and Sunday be computed from this definition. This definition does not
match reality. Merely follow the definition without concerns for inconsistencies.
I am not looking for someone do the work for my because I want to learn how to do it but I am pretty lost right now so if someone could sort of walk me through the steps I would be very grateful!! I can also post what I have so far if that helps...tbh I dont really know what I am doing
// PROGRAM LOGIC
fout << endl << endl << endl << "main program processing and output go here" << endl << endl;
z = 1;
Deposit myDeposit(3);
myDeposit.setDeposit(z);
//EXIT ROUTINE
errOut << endl << endl;
fout << endl << endl;
if (noErrors)
errOut << "No Errors Were Detected" << endl << endl << endl;
errOut << "END OF ERROR REPORT";
fout << "END OF MAIN REPORT";
cout << "Enter any key to end execution of this program . . . ";
cin >> exit; //to pause program
return 0;
}
//Opens File to read from and checks to see if it can open it or not
inputDeposit.open("Lab2.dat");
if (!inputDeposit)
{
cout << "Could not open file" << endl;
};
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 20; y++){ //inputs the data into the array
inputDeposit >> (Var);
depositArray[x][y] = Var;
cout << Var;
}
cout << endl;
}
inputDeposit.close();