// class and member/function example Fall 2002 #include #include class account { private: long int idnumber ; double balance ; double rate ; public: int branchnumber ; public: void get_input_fcn (long int, double, double); double calc_interest_fcn () { return balance * rate ; } }; //***************************************************************************** // purpose of this function is to load members in class definition (private) void account::get_input_fcn (long int a, double b, double c) { idnumber = a ; balance = b ; rate = c ; } // end of get input function //***************************************************************************** void main () { cout << setprecision (2) << setiosflags(ios::fixed) << setiosflags(ios::showpoint); long int id ; double bal ; double rt ; cout << "\nEnter Account ID: " ; cin >> id ; cout << "\nEnter Balance: " ; cin >> bal ; cout << "\nEnter Interest Rate: " ; cin >> rt ; class account checking_rec ; cout << "\n\nEnter your Branch Number: " ; cin >> checking_rec.branchnumber ; checking_rec.get_input_fcn (id, bal, rt) ; cout << "\n\nThe interest on the account is: " << checking_rec.calc_interest_fcn() ; cout << "\n\nYour branch number is: " << checking_rec.branchnumber ; } // end of main