I need to change the price of an item when its checkbox is checked. I need to do this in a for loop but I am quite unsure how to make this work. The prices are in a separate class and I do not know how to put them in an array.
This is my pizza class:
public double getCheese_Price() {
return cheese_Price;
}
public void setCheese_Price(double cheese_Price) {
this.cheese_Price = cheese_Price;
}
public double getPepperoniPrice() {
return pepperoniPrice;
}
public void setPepperoniPrice(double pepperoniPrice) {
this.pepperoniPrice = pepperoniPrice;
}
public double getChickenPrice() {
return chickenPrice;
}
public void setChickenPrice(double chickenPrice) {
this.chickenPrice = chickenPrice;
}
So, I need to set this to a certain number in this for loop but I'm not sure how to put those in an array:
for ( int i = 0; i < checkTopping.length; i++ ) {
if(checkCount >= 6 && !checkTopping[i].isChecked()) ((CheckBox) view).setEnabled(false);
else ((CheckBox) view).setEnabled(true);
if(checkTopping[i].isChecked())
{
if(!toppingList.contains(checkTString[i]))
toppingList.add(checkTString[i]);
//pizza.setPrice[i](i);??
checkCount++;
}else{
toppingList.remove(checkTString[i]);
checkCount--;
}
}