Given the following UML diagram of a class Transaction: The class Transaction re
ID: 3648270 • Letter: G
Question
Given the following UML diagram of a class Transaction:
The class Transaction represents a transaction in an account. and it has two data members to represent the type of the transaction. (examples are account opened, deposit and withdrawal) and the date on which the transaction occured.
The constructor of this class takes the type and date(current date as shown on pc) as input parameters.
The toString() function returns a string comprising the two data members, formatted in a readable way.
The getDate() function returns the date of a transaction.
________________________________________________
Please show me how to write this using QString, QDate etc exactly as explained above. And how to use it in the main() part of the program.
I don't know how to properly write the class and implement it. And how to use it in the main() of the program.
The code that I have so far is:
//Transaction Class
class Transaction
Explanation / Answer
class Transaction { private: QString m_Description; QDate m_Date/*(QDate::currentDate())*/; public: Transaction(QString c, QDate d); QString toString(); QDate getDate(); }; //Transaction implementation attempt Transaction::Transaction(QString c, QDate d) { m_Description = c; m_Date = d; //m_Date = (QDate::currentDate()); } QString Transaction::toString() { QString tinfo; QTextStream buf(&tinfo); bufRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.