Suppose there is a class called ProductOrder . This class has two instance varia
ID: 3711814 • Letter: S
Question
Suppose there is a class called ProductOrder. This class has two instance variables as shown below:
private Product p;
private int quantity;
The Product class has the following instance variables:
private String prodID;
private String prodName;
private double prodPrice;
The Product class has a full-arg constructor.
a) Write a full-arg constructor for ProductOrder class.
b) Write a code segment that will use the full-arg constructor of the ProductOrder class to create a new object. Assume the values of the instance variables are already obtained form the user.
Explanation / Answer
void setter()
{
string ISBN; //variable declaration
cout<<"Enter the ISBN number"<<endl;
cin>>ISBN; //accepting the value from the user
Product.prodID=ISBN; //storing ISBN to the prodID valriable
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.