Exception in thread
I'm new here, learning Java has be somewhat frustrating for me. I'm having difficult time with this so I would appricate your help... Error message at runtime was displayed ( It has to do with trying to parse a string that is not parsable into an int ):
Exception in thread "main" java.lang.NumberFormatException: For input string: "Supreme"
at java.lang.NumberFormatException.forInputString(NumberFormatException.
java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:518)
at Pizza.getDate(Pizza.java:34)
at Pizza.(Pizza.java:19)
at SpecialtyPizza.(SpecialtyPizza.java:13)
at PizzaDriver.storeDatabase(PizzaDriver.java:49)
at PizzaDriver.(PizzaDriver.java:12)
at PizzaDriver.main(PizzaDriver.java:125)
Here's my code:
//PlainPizza.java
public class PlainPizza extends Pizza{
private String[] toppings;
private int numToppings;
private final int MAX_TOPPINGS = 12;
public PlainPizza() {}
public PlainPizza(String date){
super("Plain Pizza Order", date);
//numToppings = MAX_TOPPINGS;
//toppings = new String[numToppings];
toppings = new String[MAX_TOPPINGS];
}
//adds number of topping to toppings array
public void addTopping(String topping) {
//numToppings = Integer.parseInt(toppings[toppings.length]);
//numToppings = (Integer.valueOf(toppings[toppings.length])).intValue();
toppings[numToppings] = topping;
numToppings++;
}
public double getPizzaCost() {
double pCost = 0;
final double PRICE_PLAINPIZZA = 8.00;
final double PRICE_TOPPING = 0.50;
pCost = PRICE_PLAINPIZZA + (PRICE_TOPPING * numToppings);
return pCost;
}
public String toString() {
String returnString = "";
returnString += super.toString();
returnString += "\n\tToppings: ";
int i = 0;
while(i < toppings.length && toppings != null){
returnString += toppings + " ";
i++;
}
return returnString;
}
} //end of PlainPizza class
Let me know if I need to post other class files associated with this...
Thanks

