public CarpetCalculator(double amountNeeded, double price)
{
noOfSqYards = amountNeeded;
pricePerSqYard = price;
}
CarpetCalculator plush = new CarpetCalculator(37.90, 17.95);
Ok, that's fine, I understand that. However, what if the variables "amountNeeded" and "price" are derived from user inputs? Then how would you call the constructor?
I tried this but received an error message:
CarpetCalculator plush = new CarpetCalculator(amountNeeded, price);
I have no idea what else to try.

New Topic/Question
Reply



MultiQuote




|