1. ## I need help badly

I need some help can you tell me the code that will give me this output. I have been trying to figure it out and I an so lost

Write a C program that allows the user to make some simple banking transactions. The program should first prompt the user to enter the current balance of his/her bank account (in dollars and cents). The program should then prompt the user to enter the number of deposits to make, and then the number of withdrawals to make.

Using a loop, the program should then prompt the user to enter the amount of the first deposit (to add to the bank account balance), the amount of the second deposit, the third, … etc., until the “number of deposits” has been processed.

Using a second loop, the program should then prompt the user to enter the amount of the first withdrawal (to subtract from the bank account balance), the amount of the second withdrawal, the third, …, etc. until the “number of withdrawals” has been processed.

Once all deposits and withdrawals have been made, the program should output the ending balance.

Note: DO NOT USE ARRAYS
The dialog with the user should look like:

Enter current balance in dollars and cents: 256.40
Enter the number of deposits: 3
Enter the number of withdrawals: 2

Enter the amount of deposit #1: 10.50
Enter the amount of deposit #2: 12.25
Enter the amount of deposit #3: 125.30

Enter the amount of withdrawal #1: 120.35
Enter the amount of withdrawal #2: 35.60

*** The closing balance is \$248.50 ***

At this point, the program should also output one of the following messages based on the closing balance. That is:

If the closing balance is greater than or equal to 5000.00, output:
"*** Time to invest some money! ***"

If the closing balance is between 2000.00 and 4999.99, output:
"*** Maybe you should consider a CD. ***"

If the closing balance is between 1000.00 and 1999.99, output:
"*** Keep up the good work. ***"

If the closing balance is between 0.00 and 999.99, output:
"*** Your balance is very low. ***"

So, in the above example, the last 2 lines of sample output would be:

*** The closing balance is \$248.50 ***
*** Your balance is very low. ***

Regarding error checking on user input, the following check should be made while users are entering the “withdrawal amounts”. If the withdrawal amount exceeds the current balance, the program should issue the following error message:

*** Withdrawal amount exceeds current balance. ***

The program should then re-prompt for a lower withdrawal amount, so not to go below current balance amount.

So, for example, a sample run of the program with error checking might look like:

Enter current balance in dollars and cents: 256.40
Enter the number of deposits: 3
Enter the number of withdrawals: 2

Enter the amount of deposit #1: 10.50
Enter the amount of deposit #2: 12.25
Enter the amount of deposit #3: 125.30

Enter the amount of withdrawal #1: 5000.00
*** Withdrawal amount exceeds current balance. ***
Enter the amount of withdrawal #1: 120.35
Enter the amount of withdrawal #2: 35.60

*** The closing balance is \$248.50 ***
*** Your balance is very low. ***

2. Sorry, but nobody here will do your whole homework for you!!!

Start some code on your own, and if you run into a problem, then post a perticular problem and i am sure someone will help you on a certain piece of code or a function in question, otherwise no no....

3. ## cprogramming

this is what I have so far

#include <stdio.h>
void main(void)
{
/* Declare variables.*/
int i, balance, pos, average, amount ;
/*Prompt user for number of values*/
float number, d
value = 0;
printf("Please enter current balance in dollars and cents ");
scanf("%f", &number);
printf("Please enter the number of deposits: ");
scanf("%i", &amount);
printf("Please enter the number of withdrawls: ");
scanf("%i", &amount);

for (i=1; i <= number ;i++)
{
printf("Enter amount of deposit # %f: ", d);
scanf("%f", &pos);
if (pos> 0)
{
balance = balance + pos;
}
else
{
printf("Invalid entry. Value must be positive");
i = i - 1;
}
} // END FOR LOOP

average = value / number;

printf("The average of the numbers is %i", average);

} // END MAIN

4. I could be going a little blind (it is late here) or perhaps is all the printf's and scanf's in the C++ forum or perhaps its the lack of CODE tags, but I don't see any variable named "value" being populated with any data other then 0?!
average = 0/number??!

#2 - The amount you enter as your current balance is being used as the number of deposits your going to make.

#3 - I can't for the life of me figure out what the d float is for.

#4 - The for loop is initialized to 1 and told to end if 1 is less then or equal to number which by the looks of things, it should be right away.

#5 - i=i-1 is a very odd way of controling your loop but so be it. However, you could express that as i--

I hope this isn't being taken the wrong way. I'm trying to figure out what this program does by examining the source. I'm seeing things like the number of deposits AND withdrawls all being dumped into the same variable (amount), which is to say that withdrawls is all that would be processed. The variable name amount seems to have little if anything to do with the input it's been programmed to collect?!!?

I'm totally lost

5. just as a comment (not to flame) this is C not C++, please try to post in the C section, but as for your program:

here is some outline code (psuedocode) for you to get started on:

prompt(balance)
prompt(num_deposits)
prompt(num_withdrawals)

for(i = 0; i < num_deposits; i++)
prompt(deposit)
value -= deposit;

//same thing with withdrawals

output(balance)

if(balance > 5000)
//same thing for each range..

post back again (with more code if you need more help)

and good luck learning C, dont worry if people mess with you, we were all newbies some time