In java I have to make the following project help me to make following methods.
ID: 3857538 • Letter: I
Question
In java
I have to make the following project help me to make following methods.
I really want to know in addBookedPoduct method how to pass (Product obj) as argument. please explain and please make the method for me.Thanks for all the help
Explanation / Answer
Customer.java
package bean;
import java.util.*;
public class Customer
{
public int customerID;
String customerName;
int customerNo;
ArrayList<Product> bookedProductList=new ArrayList<Product>();
public void addBookedProduct(Product obj)
{
obj.setProductStatus("unavailable");
bookedProductList.add(obj);
}
public int getCustomerID()
{
return customerID;
}
public void setCustomerID(int customerID)
{
this.customerID=customerID;
}
public String getCustomerName()
{
return customerName;
}
public void setCustomerName(String customerName)
{
this.customerName=customerName;
}
public int getCustomerNo()
{
return customerNo;
}
public void setCustomerNo(int customerNo)
{
this.customerNo=customerNo;
}
public Customer(int customerID,String customerName,int customerNo)
{
super();
this.customerID=customerID;
this.customerName=customerName;
this.customerNo=customerNo;
}
public ArrayList<Product> getProductList(){
return this.bookedProductList;
}
}
Product.java
package bean;
public class Product
{
public int productID;
String productName;
double productPrice;
String productStatus="Available";
public String getProductStatus()
{
return productStatus;
}
public void setProductStatus(String productStatus)
{
this.productStatus=productStatus;
}
public int quantity;
public int getQuantity()
{
return quantity;
}
public void setQuantity(int quantity)
{
this.quantity=quantity;
}
public int getProductID()
{
return productID;
}
public void setProductID(int productID)
{
this.productID=productID;
}
public String getProductName()
{
return productName;
}
public void setProductName(String productName)
{
this.productName=productName;
}
public double getProductPrice()
{
return productPrice;
}
public void setProductPrice(double productPrice)
{
this.productPrice=productPrice;
}
public Product(int productID,String productName,double productPrice)
{
super();
this.productID=productID;
this.productName=productName;
this.productPrice=productPrice;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.