Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ as simple as possible. Exercise 6.2 - 6.3 Complete program P62a.cpp by defining the member functions display and payment for class Loan. Note that

C++ as simple as possible.

image text in transcribed

image text in transcribed

Exercise 6.2 - 6.3 Complete program P62a.cpp by defining the member functions display and payment for class Loan. Note that the display function will display all the information about a loan, for example: Loan ID: Loan Amount: Loan Rate: Loan Term: Modify the class Loan and include the monthly payment as a data member in that class. Note that you still have the payment function that computes the payment. Since you include the monthly payment as a member, instead of returning a value from the function, you directly set the value for monthly payment in that function. Also, add a new function called add loans, defined as: 11. float add_loans (Loan loan1, Loan loan2); The new function, add_loans, takes two loan objects and computes the total monthly payment, i.e., the sum of monthly payments of the two loans. 1. // P62a.cpp - This program is a driver written to demonstrate how the set function work S. 2. include 3. using namespace std; 5. class Loan // Loan is called structure tag 6. { 7. public: 8. void set(); 9. float payment(); 10. void display(); 11. private: 12. int ID; // assume an unique integer between 1111-9999 13. float amount; // $ amount of the loan 14. float rate; // annual interest rate 15. int term; // number of months, length of the loan 16. }; 17. 18. int main() 19. 22. 20. Loan loani; 21. loan1.set(); 23. 24. return; 25.) 26. 27. void Loan::set() 28. 29. // Initialize the loani object 30. cout > ID; 32. 33 cout > aliount; 35. 36. cout > rate; 38. 39. cout > tera; 41. }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions