I'm pretty new to java, and I was wondering if it was possible to change this code to be a switch statement.
public double getBagelCost()
{
double bagelCost = 0.0;
if (whiteBagel.isSelected())
bagelCost = WHITE_BAGEL;
else if (wheatBagel.isSelected())
bagelCost = WHEAT_BAGEL;
else
bagelCost = CINNAMON_CRUNCH_BAGEL;
return bagelCost;
}
Aucun commentaire:
Enregistrer un commentaire