// P63.cpp - This program is a driver written to demonstrate how the constructor function works. Loan:Loan() { // Body intentionally kept empty so the default values are used. // If you wish to set the default value of the members to specific // values, here is the place to do it. // For example, to make the default value of amount = 0 // you will use amount = 0; #include class Loan / Loan is called structure tag { public: Loan(); Loan(int ID, float amount, float rate, int term); void set(); float payment(); void display(); private: int ID; // assume an unique integer between 1111-9999 float amount; // S amount of the loan float rate; // annual interest rate int term; // number of months, length of the loan }3; // You could actually copy the body of set function here too Loan::Loan(int I, float am, float rt, int trm) { ID = I; amount = am; rate = rt; term = tm; void Loan:set() int main() { Loan loan1(1234, 2300, 5.5, 48); / initialize to values given Loan loan2; // use the default values Loan loan3; Loan loan4 = loan%; // Initialize the loanl object caut << "Enter the ID ÇİR >> ID; this loan n"; cout << "Enter the amount of this loan \n"; cin >> amount; GRUR << "Display loan1 \n"; loan1.display(); cour << "Enter the annual interest rate of this loan (in %) \n"; GQUR << "Display loan2 \n"; loan2.display(); CU>> rate; cout << "Enter the term (number of months, length of the loan) \n"; GQUR << "Display loan4 \n"; loan4.display(); cin >> term; loan3.set(); // set the values CQUR << "Display loan3 \n"; loan3.display(); void Laan::display() { cout << ID << endl: cout << amount << endl: cout << rate<< endl; cout << term << endl; return 0;
// P63.cpp - This program is a driver written to demonstrate how the constructor function works. Loan:Loan() { // Body intentionally kept empty so the default values are used. // If you wish to set the default value of the members to specific // values, here is the place to do it. // For example, to make the default value of amount = 0 // you will use amount = 0; #include class Loan / Loan is called structure tag { public: Loan(); Loan(int ID, float amount, float rate, int term); void set(); float payment(); void display(); private: int ID; // assume an unique integer between 1111-9999 float amount; // S amount of the loan float rate; // annual interest rate int term; // number of months, length of the loan }3; // You could actually copy the body of set function here too Loan::Loan(int I, float am, float rt, int trm) { ID = I; amount = am; rate = rt; term = tm; void Loan:set() int main() { Loan loan1(1234, 2300, 5.5, 48); / initialize to values given Loan loan2; // use the default values Loan loan3; Loan loan4 = loan%; // Initialize the loanl object caut << "Enter the ID ÇİR >> ID; this loan n"; cout << "Enter the amount of this loan \n"; cin >> amount; GRUR << "Display loan1 \n"; loan1.display(); cour << "Enter the annual interest rate of this loan (in %) \n"; GQUR << "Display loan2 \n"; loan2.display(); CU>> rate; cout << "Enter the term (number of months, length of the loan) \n"; GQUR << "Display loan4 \n"; loan4.display(); cin >> term; loan3.set(); // set the values CQUR << "Display loan3 \n"; loan3.display(); void Laan::display() { cout << ID << endl: cout << amount << endl: cout << rate<< endl; cout << term << endl; return 0;
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 9RQ
Related questions
Question
Modify the given c++
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT