Click here to Skip to main content
15,915,857 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thanks everyone... Pin
Alvaro Mendez11-Dec-02 8:46
Alvaro Mendez11-Dec-02 8:46 
GeneralExpense of creating GDI objects Pin
raja huus11-Dec-02 3:52
sussraja huus11-Dec-02 3:52 
QuestionHow are the UI stuff actually drawn by Windows Pin
Malcom Krujic11-Dec-02 3:32
sussMalcom Krujic11-Dec-02 3:32 
AnswerRe: How are the UI stuff actually drawn by Windows Pin
jhwurmbach11-Dec-02 3:52
jhwurmbach11-Dec-02 3:52 
AnswerRe: How are the UI stuff actually drawn by Windows Pin
Maximilien11-Dec-02 3:59
Maximilien11-Dec-02 3:59 
GeneralRe: How are the UI stuff actually drawn by Windows Pin
MALCOM11-Dec-02 4:11
MALCOM11-Dec-02 4:11 
GeneralTime span format Pin
dabs11-Dec-02 3:28
dabs11-Dec-02 3:28 
GeneralCheckBook program Pin
Autunmsky11-Dec-02 3:25
Autunmsky11-Dec-02 3:25 
Hello everyone....Hope everyone is ready for the holidays and had a great Thanksgiving. I working on a new program to balance a check book.....There is just acouple of things I am stumped on. I need to put a bool varible in but I just don't know where to put it by the way I have ti set up. It's supposed to charge the person a 5.00 fee if the account balance falls below 500.00 at anytime during the month....and only charged once. And my other problem is how am I supposed to keep track of all of my charges for the month and I have to but the final amount of charges on my final screen...... Forexample of output screens....

Deposit Trans.

Deposit Amount: 100.00
current Balance: 600.00
deposit charge: .10 (for every depost made)
total charges : .45 (just the added sum of all charges so far that month....just not taken from balance until end of the month)

Check Trans.

Check amount: 600.00
Current Balance: 425.00
check charge: .15 ( for every deposit)
One Time Below 500.00 Charge: 5.00
total charges: 5.60

Any help would be appreciated... Here is my program...hopefully it isn't too hard to read


#include <iomanip>
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

void PrintInstructions (float&, string&);
void GetSingleTransInfo(char&, float&);
void ProcessDeposit (float, float, float&);
void ProcessCheck (float, float, float&);
void PrintFinalTotals ();
void PrintBlankLines (int);

const float CHECK_CHARGE = .15f;
const float DEPOSIT_CHARGE = .10f;
const float ONE_TIME_CHARGE = 5.00f;
int main ()
{
string month;
float balance;
float transAmount;
char transCode;
bool below500;
float currentBalance;


PrintInstructions (balance, month);

GetSingleTransInfo (transCode, transAmount);



if (transCode == 'C')

{ ProcessCheck(transAmount, balance, currentBalance);
}
else if (transCode == 'D')
ProcessDeposit(transAmount, balance, currentBalance);

else
cout <<" This is the end of the month\n";



return 0;
}



//************************************************************************************************************

void PrintInstructions(/*out*/ float& beginBalance, /*out*/ string& month)

// Purpose: Prints general instructions about how to use the program and will ask the user to enter the
// month and the beginning balance for the month.
// Pre:
// Post: None


{



cout <<"\n \"Balancing Your Checkbook\"\n";

PrintBlankLines (3);

cout << "This is a program to help you balance your checkbook for the month. The\n";
cout << "program will ask you to input the month name and the beginning balance\n";
cout << "for the month. The program will then ask you to input a transaction code.\n";
cout << "The transaction codes are as follows:\n\n";
cout << " C or c - for a check\n";
cout << " D or d - for a depsoit\n";
cout << " E or e - for the end of the month\n\n";
cout << "For each transaction code (except for E/e) the user needs to input the\n";
cout << "transaction amount. For each transaction any charges towards the account\n";
cout << "will be listed but will not be applied to your balance until the end of\n";
cout << " the month.\n\n";
cout << "The following charges will be accumulated and applied to your balance\n";
cout << " at the end of the month:\n\n";
cout << " * 10 cents for each deposit and 15 cents for each check processed.\n";
cout << " * A one time charge of 5.00 if the account balance falls below \n";
cout << " 500.00 at anytime during the month.\n";
cout << " * A service charge of 10.00 for each check that either puts the\n";
cout << " balance below zero or keeps the balance below zero.\n";

PrintBlankLines (3);

cout << "Please enter the month to be balanced: ";
cin >> month;

cout << endl;

cout << "Please enter the beginning balance for the month: ";
cin >> beginBalance;

PrintBlankLines (3);

system ("pause");
system ("cls");
}




//***************************************************************************************************************

void GetSingleTransInfo (/*out*/ char& code, /*out*/ float& amount)

// Purpose: This function should get the transaction code and the amount of the transaction
// from the user (if the transaction code is not an E or E).
// Pre: None
// Post: Code has a value of C, D, or E.

{
PrintBlankLines (4);

cout << " Select form the following transactions:\n\n";
cout << " C / c - for a check\n";
cout << " D / d - for a deposit\n";
cout << " E / e - for end of the month\n\n";

PrintBlankLines (3);

cout << "Enter you transaction choice: ";
cin >> code;

code = toupper (code);

cout << endl;

while (code != 'C' && code != 'D' && code != 'E')
{
cout << "\nError.....you must select a code from above\n\n";
cout << "Please enter a new transaction code: ";
cin >> code;
cout << endl;

code = toupper (code);
}

if (code == 'C' )
{
cout << "Please enter transaction amount: ";
cin >> amount;
cout << endl;
}

if (code == 'D')
{
cout << "Please enter transaction amount: ";
cin >> amount;
cout << endl;
}


system ("pause");
system ("cls");




}
//***************************************************************************************************************

void ProcessCheck(/*in*/ float amount, /*in*/ float balance,
/*out*/ float& currBalance)

// Purpose: Deduct amount of check from balance....apply charges if balance falls below zero by
// cause of check. Apply charge if balance falls below $500.00.
// Pre:
// Post:

{



currBalance = balance - amount;

cout << " Check Transaction\n\n\n";



cout << fixed << setprecision (2) << endl;
cout << "Check Amount: " << amount << endl;
cout << "Current Balance: " << currBalance << endl;
cout << "Check Charge: " << CHECK_CHARGE << endl;
system ("pause");
system ("cls");
}
//***************************************************************************************************************
void ProcessDeposit (/*in*/ float amount, /*in*/ float balance,
/*out*/ float& currBalance)

{

currBalance = balance + amount;

cout << " Deposit Transaction\n\n\n";


cout << fixed << setprecision (2) << endl;
cout << "Deposit Amount: " << amount << endl;
cout << "Current Balance: " << currBalance << endl;
cout << "Deposit Charge: " << DEPOSIT_CHARGE << endl;

}



Thanks for you time once again!!

Autumn
"Hitting her head against a brick wall"

WTF | :WTF:
QuestionHow to create new DNS Zone with C/C++? Pin
Matias11-Dec-02 3:20
Matias11-Dec-02 3:20 
QuestionListCtrl: How can i make the last column visible for the user? Pin
whofmans11-Dec-02 2:36
whofmans11-Dec-02 2:36 
AnswerRe: ListCtrl: How can i make the last column visible for the user? Pin
Roger Allen11-Dec-02 2:55
Roger Allen11-Dec-02 2:55 
GeneralIVariantDictionary HELL !!!! Pin
Christian Graus11-Dec-02 0:59
protectorChristian Graus11-Dec-02 0:59 
GeneralRe: IVariantDictionary HELL !!!! Pin
Stephane Rodriguez.11-Dec-02 2:02
Stephane Rodriguez.11-Dec-02 2:02 
GeneralRe: IVariantDictionary HELL !!!! Pin
Christian Graus11-Dec-02 10:05
protectorChristian Graus11-Dec-02 10:05 
GeneralRe: IVariantDictionary HELL !!!! Pin
Stephane Rodriguez.11-Dec-02 10:16
Stephane Rodriguez.11-Dec-02 10:16 
GeneralRe: IVariantDictionary HELL !!!! Pin
Rene De La Garza11-Dec-02 3:37
Rene De La Garza11-Dec-02 3:37 
GeneralRe: IVariantDictionary HELL !!!! Pin
Daniel Turini11-Dec-02 4:32
Daniel Turini11-Dec-02 4:32 
GeneralScrolling in Listbox Pin
kubbazoob11-Dec-02 0:06
kubbazoob11-Dec-02 0:06 
GeneralRe: Scrolling in Listbox Pin
Joan M11-Dec-02 5:18
professionalJoan M11-Dec-02 5:18 
GeneralRe: Scrolling in Listbox Pin
Alvaro Mendez11-Dec-02 8:43
Alvaro Mendez11-Dec-02 8:43 
QuestionHow to remove a handle HFONT from memory? Pin
Daed11-Dec-02 0:00
Daed11-Dec-02 0:00 
AnswerRe: How to remove a handle HFONT from memory? Pin
Gert Boddaert11-Dec-02 0:25
Gert Boddaert11-Dec-02 0:25 
AnswerRe: How to remove a handle HFONT from memory? Pin
Ted Ferenc11-Dec-02 0:34
Ted Ferenc11-Dec-02 0:34 
AnswerRe: How to remove a handle HFONT from memory? Pin
Daed11-Dec-02 2:58
Daed11-Dec-02 2:58 
GeneralRe: How to remove a handle HFONT from memory? Pin
Ted Ferenc11-Dec-02 5:11
Ted Ferenc11-Dec-02 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.