CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jun 2008
    Posts
    5

    Red face Coding for Interest rate

    Hi Guys!! Can help me how to create coding for calculating interest rate function? I am stuck... Please help..

    Class Account
    Hold variables of interest rate and deposit.
    Make deposit() Withdrawal() function that checks if money in the account is enough to be withdrawn.
    Show output if deposit $5000 for 12 months. 5% interest rate.
    Initial deposit $20000.
    Write main ()

    Codes:

    Code:
    #include <string>
    #include <stdio>
    #include <stdlib>
    #include <conio>
    #include <iostream>
    
    class Account 
    {
    private:
    int Interest; 
    double Deposit; 
    public:
    	Account()
    	{
    		Interest = 0.05;
    		Deposit = 20000;
    	}
    
    	void makeDeposit();
    	void withdrawal();
    };
    
    void Account::makeDeposit()
    {	double amount;
    cout << endl << "Deposit Amount : ";
    cin >> amount;
    	Deposit = Deposit + amount;
    	cout << endl << "Balance : " << Deposit;
    }
    void Account::withdrawal()
    {	double amount;
    cout << endl << "Withdrawal Amount : ";
    cin >> amount;
    	if((Deposit>=0)&&(Deposit >= amount))
    	{Deposit = Deposit - amount;}
    	cout << endl << "Balance : " << Deposit;
    }
    
    void main()
    {
    	Account theAccount;
    	theAccount.makeDeposit();
    	theAccount.withdrawal();
    }
    Last edited by ovidiucucu; June 8th, 2008 at 04:43 AM. Reason: [CODE] tags added

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured