Hi I was trying to make a arraylist of objects and add more with data via argument to the constructor to make objects. Here is part of my code, wondering if anybody could give me some insite?
ArrayList purchase = new ArrayList();
String answer;
System.out.print("Please enter the price or enter -1 to quit");
price=in.nextDouble();
if (price!=-1){
System.out.print("Is this purchase a pet Y/N");
answer= in.nextLine();
if (answer.equals("Y")){
answer1=true;
}
purchase.add(new Item(price,answer1));