Question: #include #include using namespace std; class Invoice { private: string a; string b; int c; int d; public: Invoice ( string pA , string pB
#include
#include
using namespace std;
class Invoice
private:
string a;
string b;
int c;
int d;
public:
Invoicestring pA string pB int pC int pD
a pA;
b pB;
setCpC;
setDpD;
void setAstring pA
a pA;
void setBstring pB
b pB;
void setCint pC
if pC
c ;
else
c pC;
void setDint pD
if pD
d ;
else
d pD;
string getA const
return a;
string getB const
return b;
int getC const
return c;
int getD const
return d;
int getInvoiceAmount const
return c d;
The Copy constructor
Invoiceconst Invoice& other
a other.a;
b other.b;
c other.c;
d other.d;
The Destructor
~Invoice
cout "Invoice for a is being destroyed." endl;
The Clone method
Invoice clone const
return Invoicethis;
The Overloaded clone method with reference
Invoice cloneconst Invoice& other const
return Invoiceother;
;
use the above code, add:
Task write a test program to demonstrates class Invoices capabilities defined in
Task The test program should follow the unit testing structure introduced at the lecture demos. A reference example is on the Summary and reference web page on Moodle. points
The main function should follow the assertion format to print out pass or fail for each unit test. For example
unit testing
std:: string message testArrayAccess "passes!": "fails!";
assertion form for calling the unit testing function;
std:: cout "The case for array access message std::endl
Finally, it should print out a statistics as m n pass and k n fail given the runtime unit test output, where m is the number of pass cases and k is the number of fail cases, and n is the number of total unit testing cases.
For example, if total number of test cases are invoked in the main and cases pass. The program should print out pass and fail
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
