You should only pass something as an argument if you need prior information to do what you want to do, so the parameters of flatfee
and co. should be empty:
flatFee() { // code here }
you then declare a
as a local variable:
flatFee() {
double a;
// do stuff
return a * 5.0;
}
After that, you can pass the result of methods as arguments directly without using variables like so:
picnicCost(flatFee(), MealP(), iceCreamCost());
solved How to call a method from main, even though I haven’t defined variables in main. [closed]