I am really at my wits end with this program. I have been tinkering with it for days. This program is a bank account program that processes checks deposits and withdrawls. It reads the data from an infile. The problem that I cannot figure out is that I am not getting any output at all except for 0's across the board. Im a beginner.. obviously after you read my code you can tell. We havent discussed classes yet. The account cant drop below $500 or theres a $5 surcharge, and if its below $50 at anypoint , it gives a warning.
Any advice/help with this would be greatly appreciated. I am a bundle of stress because of this. Thank you
float main ()
{
infile.open("MWhite4.dat"
outfile.open("MWhite4.out"
outfile<<setw(15)<<"Transaction"<<setw(15)<<"amount"<<setw(15)<<"Date"<<setw(17)<<"Balance"<<setw(10)<"Notice"<<endl;
inData(q,o,i,z);
while (infile)
{
if ( transaction == 'D')
deposit(A);
else if ( transaction == 'W')
withdrawl(A);
else if (transaction == 'C')
check (A);
if ((month == 1) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 2) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 3) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 4) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 5) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 6) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 7) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 8) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 9) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 10) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 11) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 12) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
printData();
inData(q,o,i,z);
}
return 0;
}
void inData(char transaction, float amount, float month, float day)
{
infile >> transaction >> amount >> month >> day;
}
float deposit(float& balance)
{
balance = balance + amount - dService;
return balance;
}
float withdrawl(float& balance)
{
balance = balance - amount - wService;
return balance;
}
float check(float& balance)
{
balance = balance - amount - cService;
return balance;
}
void printData()
{
outfile <<setw(15)<<transaction<<setw(15)<<amount<<setw(10)<<month<<setw(5)<<day<<setw(17)<<setw(10)<<balance<<setw(10)<< endl;
}
Any advice/help with this would be greatly appreciated. I am a bundle of stress because of this. Thank you
float main ()
{
infile.open("MWhite4.dat"
outfile.open("MWhite4.out"
outfile<<setw(15)<<"Transaction"<<setw(15)<<"amount"<<setw(15)<<"Date"<<setw(17)<<"Balance"<<setw(10)<"Notice"<<endl;
inData(q,o,i,z);
while (infile)
{
if ( transaction == 'D')
deposit(A);
else if ( transaction == 'W')
withdrawl(A);
else if (transaction == 'C')
check (A);
if ((month == 1) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 2) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 3) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 4) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 5) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 6) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 7) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 8) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 9) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 10) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 11) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
else if ((month == 12) && (balance < 500.00))
{
balance = balance - bService;
if (balance < 50.00)
outfile << "Your monthly balance is lower than $50.00." << endl;
}
printData();
inData(q,o,i,z);
}
return 0;
}
void inData(char transaction, float amount, float month, float day)
{
infile >> transaction >> amount >> month >> day;
}
float deposit(float& balance)
{
balance = balance + amount - dService;
return balance;
}
float withdrawl(float& balance)
{
balance = balance - amount - wService;
return balance;
}
float check(float& balance)
{
balance = balance - amount - cService;
return balance;
}
void printData()
{
outfile <<setw(15)<<transaction<<setw(15)<<amount<<setw(10)<<month<<setw(5)<<day<<setw(17)<<setw(10)<<balance<<setw(10)<< endl;
}