Help with a program...

/no answers! just guidance, please. here is the copy.paste of the assignment. If anyone could help, greatly appreciated.

Program: You and I are working together to create a transaction program for a bank. My job is to create the main function that will run the program (which I’ve already done), and you are to create the functions that do all of the work. I have included the code I have written. You are to add your code to the file, and you are not to change or add anything in the body of the main that I’ve written.

Specifications:
1) You are only supposed to add four functions: printBalances, readInput, withdraw, deposit

printBalances
Precondition: take in two double values (account balances) as parameters
Postcondition: print the value of the two parameters.
(Assume the first is the checking account balance and the second is the savings account balance)

readInput
Precondition: prints menu choices and prompts the user to enter number of menu choice
Postcondition: returns valid menu choice

withdraw
Precondition: take in a double (account balance) as a parameter and Prompt the user to enter a withdrawal amount
Postcondition: update the account balance so that the change is reflected outside of the function

deposit
Precondition: take in two double values (account balance and deposit amount) as parameters. Update account balance.
Postcondition: return updated account balance

Error Cheking:
1) The user should not be allowed to overdraw either of their accounts.
2) All entered monetary amounts must be non-negative.

Start by declaring the four functions. The preconditions tell you what parameters the functions should take, and the postconditions tell you what value (if any) the functions should return. If you're still not sure, you can look at the main() function, where you should see each of these functions being called. You can look at what parameters are being passed to the functions and what return value is expected.

Once you've done that, implement each function. Start by making each function do absolutely nothing other than return a hard-coded value. For example, your deposit function could simply return $42.

At that point, you should be able to compile the program.

Next, implement readInput, since that is the first function that is called. Once you have that working (you should still be able to compile and run the program), pick one of the remaining three and provide a real implementation for it. Test that function by compiling and running. Repeat the process for the remaining two functions.
i need to see how it looks because im lost...lol
@jsmith thanks! Will try and post the code here later.
I dont quite understand why you need us to write them I mean you know exactly what they are supposed to do.
@bboy212 I don't want anyone to write them. Just guidance, I've never written one beginning to end like that.
What have you tried, Shannon? Did you follow jsmith's advice?
ok here they are.


readInput(int readInput);

{
int Choice;
cout<< 1) Withdraw Checking, 2) Deposit Checking 3) Withdraw from Savings, 4) Deposit to Savings;
cout<< "Enter your choice" endl;
cin>> Choice;
return Choice;
}



//ask user for withdrawal amount and updates account balances
double withdraw(double& balance )
{

double amount = 0; //sets amount to zero
//do while loop for error checking values that are negative cause loop to activate
do
{
cout<<"How much would you like to withdraw $";//ask user for withdrawal amount
cin >> amount;//takes in withdrawal amount from user
}while(amount < 0);
//if statement verifies that withdrawal amount is less or equal to account balance
//if so function returns new balance amount otherwise amount is more than balance
if (amount <= balance)
{
balance = balance - amount; //subtracts user entered withdrawal amount from balance
return balance;
}
else
{
cout<<"You do not have enough money in your account\n";

}





//ask user for deposit amount and updates account balances
double deposit(double& balance )
{

double amount = 0; //sets amount to zero

cout<<"How much would you like to deposit $";//ask user for deposit amount
cin >> amount;//takes in deposit amount from user

balance = balance +amount; //adds user entered deposit amount to balance
return balance;
}


//prints the balance after each transaction
void printBalances

{
printBalances


}
got it to compile! Thanks guys, problem solved!
@ultifinitus yes I took @jsmith's advice! Thanks!
Topic archived. No new replies allowed.