Question: 6. 3.10 (Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the

 6. 3.10 (Invoice Class) Create a class called Invoice that ahardware store might use to represent an invoice for an item sold

6. 3.10 (Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four data members -a part number (type string), a part description (type string), a quantity of the item being purchased (type int) and a price Rectangular per item (type int). Your class should have a constructor that initializes the four data members. Provide a set and a get function for each data member. In addition, provide a member function named getInvoiceAmount that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as an int value. If the quantity is not positive, it should be set to o. If the price per item is not positive, it should be set to o. Write a test program that demonstrates class Invoice's capabilities. /** ** 1 . T a }; tart here X main.cpp X 1 #include 2 #include 3 using namespace std; 4 5 class invoice 6 | { 7 public: 8 9 void setpartnumber (string pnum) {partnumbe=ptnum; } 10 11 void partdescription (string ptdescrip) {partdesc=ptdescrip} 12 void itemquantity (int itemquan){itemquantity=itemquan; } 13 void itemprice (int itpri) {itemprice=itpri;} 14 15 //getters 16 string getpartnumber (void) { return partnumber;} 17 string getpartdescription (void) {return partdescription} 18 int getitemquantity (void) { return itemquantity } 19 int getitemprice (void); { return itemprice} 20 int getinvoiceamount (void);{ return invoiceamount} 21 22 23 24 private: 25 string partnumber; 26 string partdesc; 27 int itemquantity; 28 int item price; 29 }; 30 int main () {invoice myinvoice; } 31

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!