im making a system in the style of a library where users can borrow different types of items such as books, dvds etc. i need to make an arrylist of loans so that each individual member will hold their own list of loans. im trying to make it so the "media" is referenced in the loan class by whatever the items title is but its not allowing me to create the loan objects.
**Member Class**
import java.util.ArrayList;
public class FullMember extends Member {
ArrayList<Loan>theLoans = new ArrayList<Loan>();
public FullMember() {
/*Loan l;
l = new Loan(null, "12/2/12");
theLoans.add(l);
*/
}
public FullMember(String newUserName, String newPassWord, String newFirstName, String newLastName) {
super(newUserName, newPassWord, newFirstName, newLastName);
setPrivilege("Full");
}
public String getMemberDetails() {
return getId() + " " + getFirstName() + " " + getLastName() + " " + getPrivilege();
}
}
**Loan Class**
public class Loan {
private Media title;
private String loanDate;
public Loan() {
loanDate = "not Set";
// TODO Auto-generated constructor stub
}
public Loan(Media Title, String loanDate) {
this.setloanTitle(Title);
}
public Media getloanTitle() {
return title;
}
public void setloanTitle(Media loanTitle) {
this.title = loanTitle;
}
}
**Media Class**
public abstract class Media {
private static int count;
private int id;
private String title;
private double costPrice;
private String publisher;
public Media() {
count = 0;
id = count;
title = "not set";
costPrice = 0.0;
publisher = "not set";
}
public Media(String newTitle, Double newPrice, String newPublisher) {
count++;
id = count;
title = newTitle;
costPrice = newPrice;
publisher = newPublisher;
}
public int getID() {
return id;
}
public void setID(int newID) {
this.id = newID;
}
public String getTitle() {
return title;
}
public void setTitle(String newTitle) {
this.title = newTitle;
}
public double getCost() {
return costPrice;
}
public void setCost(double cost) {
this.costPrice = cost;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String newPublisher) {
this.publisher = newPublisher;
}
public String getMediaDetails() {
return "no media objects should be created";
}
}
My arraylist of members is held in a "Model" class but wastold that members hold thier will be an arraylist of loans inside members. Any help would be greatly appreciated and if question not clear enough will happily try and explain it better. Thanks