29-05-2014, 05:25 AM
Q2Invoice 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 per item (type int).
Your class should have a default constructor that initializes the four data members (space for strings data types and 0 for int) and a parameterized structure that initializes the four data members (values which are given by user).
Provide a public set and a get member functions for each data member.
Set member functions will receive values from main by user. Get member functions will return values instead of printing them.
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.
Also implement the following checks in set methods, if the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.
Write a main method that demonstrates class Invoice’s capabilities.
Reference: http://seminarprojectsshowthread.php?mode=linear&tid=94306#ixzz333dROO9L
i need the prgm code
Your class should have a default constructor that initializes the four data members (space for strings data types and 0 for int) and a parameterized structure that initializes the four data members (values which are given by user).
Provide a public set and a get member functions for each data member.
Set member functions will receive values from main by user. Get member functions will return values instead of printing them.
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.
Also implement the following checks in set methods, if the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.
Write a main method that demonstrates class Invoice’s capabilities.
Reference: http://seminarprojectsshowthread.php?mode=linear&tid=94306#ixzz333dROO9L
i need the prgm code