Answer:
The answer using java programming language is in the explanation section
See detailed explanations in the comments within the code
Step-by-step explanation:
//The class Product begins here
public class Product {
private int quantity;
private double price;
//First Constructor No argument
public Product() {
}
//Second Constructor Two argument
public Product(int quantity, double price) {
this.quantity = quantity;
this.price = price;
}
//Get Methods
public int getQuantity() {
return quantity;
}
public double getPrice() {
return price;
}
//Set Methods
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public void setPrice(double price) {
this.price = price;
}
}
//End of Product Class
//Test class containing the main method begins here
class ProductTest{
public static void main(String[] args) {
//Creating two objects of Product
Product productOne = new Product(1000, 50.5);
Product productTwo = new Product (5000, 60);
//Displaying the product object's data
System.out.println("Product one quantity is "+productOne.getQuantity()+" and the unit price is" +
"is "+productOne.getPrice());
System.out.println("Product Two quantity is "+productTwo.getQuantity()+" and the unit price is" +
"is "+productTwo.getPrice());
}
}