Here is my problem. I have searched everywhere for help on this one. I haven't found any. So, I sat down and tried the best I could to write this code: Now I am stuck:
Here is what I have so far:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main ()
{
ifstream inFile;
int custID, newBal, intRate;
cout.precision(2);
inFile.open("cardholders.txt");
cout << "Reading information from the file.\n\n";
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
{
// Make sure we use types that hold decimal places
double custID, minPay, curBal, newBal, lateFee, intRate, Y, N;
cout << "What is your current balance:";
cin >> curBal;
if (curBal<10.00)
minPay = curBal;
else (curBal>10.00);
minPay = curBal * 0.15;
cout << "Was payment late:";
cin >> Y or N;
if (lateFee = N)
lateFee = minPay;
else (lateFee = Y);
}
else (curBal < 40)
minPay = minPay + 15;
else (curBal > 40 && < 100)
minPay = minPay + 30;
else (curBal > 100)
minPay = minPay + 45;
return 0;
}
{
cout << "Enter current balance:";
cin >> curBal;
cout<<" Enter Late Fee:";
cin >> lateFee;
cout << "Enter Current Payment:";
cin >> minPay;
cout << "New Balance is:";
cout << (curBal + lateFee) - minPay << endl;
cout << "File written to, and now being closed..." << endl;
outputFile.close();
cout << "Done.\n";
{
{
ifstream inFile;
int custID, newBal, intRate;
inFile.open("cardholders.txt");
cout << "Reading information from the file.\n\n";
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
// Process Customer 1
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
cout << "Customer ID 1: " << newBal << intRate << endl;
// Process Customer 2
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
cout << "Customer ID 2: " << newBal << intRate << endl;
// Process Customer 3
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
cout << "Customer ID 3: " << newBal << intRate << endl;
// Process Customer 4
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
cout << "Customer ID 4: " << newBal << intRate << endl;
// Process Customer 5
inFile >> custID;
inFile >> newBal;
inFile >> intRate;
cout << "Customer ID 5: " << newBal << intRate << endl;
// Close the file
inFile.close();
cout << "\nDone.\n";
system("PAUSE");
return 0;
}
Heres is what I need it to do:
* The program should read all the records in the file cardholders.txt until the end of the file. Each cardholder record contains the customer ID, current balance, and APR.
* For each record read, the program should do the following:
• Calculate the minimum payment due for the next billing cycle. If the current balance is less than $10.00, then the minimum payment will be the current balance. Otherwise, the minimum payment will be the greater of $10.00 or 15% of the current balance.
• Ask the user to enter the amount of the current payment for the customer with this ID. Ask the user whether the payment was late.
• Calculate the late fee. If the payment was not late, there will be no late fee.
For late payments:
• If the current balance is less than $40, the late fee will be $15.
• If the current balance is in the range from $40 to $100, the late fee will be $30.
• If the current balance is over $100, the late fee will be $45.
• Use a function called NewBalance to calculate the customer’s new balance. (You must create this function.) The function NewBalance will accept the APR, late fee, current balance, and current payment as input parameters and return the customer’s new balance.
• Store the data for this customer in three parallel arrays, custID, newbal, and minpay. These three arrays should respectively hold each customer’s ID, new balance, and minimum payment.
After all the records in the cardholders.txt file have been processed, the program should display a report with three columns showing each customer’s ID, new balance, and minimum payment. The columns should be aligned appropriately. The new balance and minimum payment should be displayed in currency format with 2 fixed decimal places.
Where do I go from here? I am literally stuck.
Forgive me, but I am just trying to get through this without going nuts. I am an IT major. I have to take these classes as part of my core. I am almost done with all of it. I have been doing great up to this one and it is kicking my rear. I have been looking at code for what seems like an eternity. Unfortunately, I also had to take webpage class this semester and sometimes it seems the code from one runs on to the other. I am just trying to survive this class. I have an "A" in the class as of right now, but at this point I will settle for a "B". I am just frustrated with this whole thing.
Sorry for venting. Thanks for all of your help.
OK, now, how can you help me?
Oh, and btw, Can you run the 3 parrellel code for me with attached file? It is working but output is wrong.