Question: Program to find simple interest using class in C++? Please help me,i will give you 10 points.Please write the code of C++ using class

Answer: I'd love to help you, but I'm not sure what you're looking for.  Part of the problem, perhaps, is that while I'm a good computer programmer with 12+ years programming in C++ I'm really lousy with finances and I'm not sure I could work out interest by hand.\n\nBut even if I could, it makes no sense to develop this as a class if you don't have either related functions or persistant data.  I can't envision this taking more than one function to implement unless you stretch it some.  But if you were to stretch it, try this:\n\nclass InterestCalculator\n{\npublic:\n   InterestCalculator()  {SetRate(0.05);}\n   void SetRate(double r) {Rate = r;}   //Add error checking here\n   double CalcInterest(double money, int months);\n\nprivate:\n   double Rate;\n};\n\nint main()\n{\nInterestCalculator calc;\n\ncalc.SetRate(0.10); //set rate to 10 percent;\n\ncout << "$500 for two years at a 10% rate has an interest of " << calc.CalcInterest(500, 24) << endl;\n}\n\nNow, that's a rather contrived solution, designed to use a class even where it makes little sense to do so.  I don't know if this helps or not. I've left the implementation of calculating the interest rate to you (as I said, I'm not sure how to do it even by hand).\n\nIf you have more information on what else the class should do so that it makes more sense as a class, modify your question here or shoot me an e-mail and I'll see what help I can be.\n\nGood luck.
This question from the Yahoo Q&A forum is categorized in the topic: Sports