My code is supposed to output:
Enter account balance:
Enter account interest rate:
Enter the number of months until maturity
(must be 12 or fewer months):
When your CD matures in _ months,
it will have a balance of $(whatever the total is)
but it keeps telling me that EVERYTHING is not accessible in function main( )... Here is my code, please help me out, I would appreciate it A LOT!!
Code:#include <iostream> using namespace std; class CDAccount { public: void input( ); void output( ); void set(int new_balance, int new_interest_rate, int new_term); int get_balance( ); int get_interest_rate( ); int get_term( ); int get_data( ); private: //void check_data( ); int balance; int interest_rate; int term; }; int main( ) { CDAccount account;//, get_data; double rate_fraction, interest; rate_fraction = account.interest_rate/100.0; interest = account.balance*rate_fraction*(account.term/12.0); account.balance = account.balance + interest; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); cout << "When your CD matures in " << account.term << " months,\n" << "it will have a balance of $" << account.balance << endl; return 0; } void CDAccount::input( ) { cout << "Enter account balance: $"; cin >> balance; cout << "Enter accouunt interest rate: "; cin >> interest_rate; cout << "Enter the number of months until maturity\n" << "(must be 12 or fewer months): "; cin >> term; //check_data( ); } void CDAccount::output( ) { cout << "balance =" << balance << ", interest rate = " << interest_rate << ", term = " << term << endl; } void CDAccount::set(int new_balance, int new_interest_rate, int new_term) { balance = new_balance; interest_rate = new_interest_rate; term = new_term; //check_data( ); } int CDAccount::get_balance( ) { return balance; } int CDAccount::get_interest_rate( ) { return interest_rate; } int CDAccount::get_term( ) { return term; }



LinkBack URL
About LinkBacks



