C++ Programming HELP NEEDED ANYONE!

Hi,

I have a program that I am working on but I need some help with it.

Here is the problem.

The Silly Savings and Loan Company just opened up with a cash balance of $1000, and a plan to get rich. Their plan to make money is simple. They will charge no fee for checks, and a 3% fee for all deposits. At the end of each day, they will count up their profits. One problem, though. They do not know much about computers (or even calculators) and they have hired you to write a simple program for them. They will run your program and enter deposits as positive numbers, and checks as negative numbers. All transactions will be recorded in the order they happen. When they run out of things to enter at the end of the day, they will enter a value of 0 to stop the program.
The program needs to add up both sets of numbers (deposits and checks) and figure out the amount of cash they should have at the end of the day. For every deposit, the 3% fee will be removed from the amount actually deposited, that amount will be added in to the profit they expect to make.
Once the data entry has been completed, the program will print out the total amount of checks written (as a positive number), the total amount of deposits received, the amount of cash they should have on hand, and the total profit earned that day.
Here are the transactions for their first day of operation:
Deposit $100.00
Check $500.00
Deposit $250.00
Deposit $25.00
Check $75.50
Deposit $27.50
Check $775.27

Here is what I have been able to work on but it still isn't working right I need help on this.

#include <iostream>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{

float startingBalance = 0.0;
float deposit = 0.0;
float check = 0.0;
float totalDeposits = 0.0;
float totalChecks = 0.0;
float transAmount = 0.0;
float profit = totalDeposits*0.03;
float dailyTotal = 0.0;

dailyTotal = startingBalance + totalDeposits + profit + totalChecks;;

cout << "Enter Starting Balance: ";
cin >> startingBalance;

cout << "Enter Transaction Amount (use - for check, 0 to end day): " << transAmount << endl;
cin >> transAmount;

while (transAmount !=0)
{

dailyTotal = dailyTotal + transAmount;;
cout << "Enter Next Amount: $" << transAmount << endl;
cin >> transAmount;
} //end while

if (transAmount > 0);
cin >> deposit;

if (transAmount < 0);
cin >> check;
//end if << endl;

cout << "Total Deposit Amount: " << totalDeposits << "$" << endl;
cout << "Total Checks: " << totalChecks << "$" << endl;
cout << "Total Profit from Deposits: " << profit << "$" << endl;
cout << "Cash On Hand: " << dailyTotal << "$" << endl;

}


I can't see where you use totalDeposits, totalChecks or profit practically.

"dailyTotal = startingBalance + totalDeposits + profit + totalChecks;" is put there in fact done nothing.

Apart from using iostream, it's in fact C, not C++. At least try class. You can create a class to cover the calculation for daily.
I have been changing it around trying to find different ways here is what I have been able to come up with.

I really need help in finding a way where the program will let me input the deposit value and the checks values as a sum but I can't figure it out.


#include <iostream>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
float deposits = 0.0;
float checks = 0.0;
float startingBalance = 0.0;
float totalDeposits = 0.0;
float totalChecks = 0.0;
float transactionAmount = 0.0;
float profit = deposits * 0.03;
float dailyTotal = 0.0;

while (transactionAmount !=0)
{
transactionAmount = +(deposit)-(checks);;

cout << "Enter Next Amount: $" << transactionAmount << endl;
cin >> transactionAmount;


} //end while

cout << "Starting Balance: $" << endl;
cin >> startingBalance;

cout << "Enter Deposits: $" << endl;
cin >> deposits;

cout << "Enter Checks: $" << endl;
cin >> checks;

dailyTotal = startingBalance + deposits + profit - checks;;

cout << "Total Deposit Amount: $" << deposits << endl;
cout << "Total Checks: $" << checks << endl;
cout << "Total Profit from Deposits: $" << profit << endl;
cout << "Cash On Hand: $" << dailyTotal << endl;
}
Topic archived. No new replies allowed.