What would be appropriate names for the missing variables and method in the ShoppingCart class to accurately represent their purposes?
Naming variables
Filling the gaps in retail's digital basket
Report a typo
Fill in the gaps with the relevant elements
ShoppingCart {
public calculateTotalCost(double[] itemPrices, [] itemQuantities) {
double totalCost = 0.0;
for (int i = 0; i < itemPrices.length; i++) {
totalCost += itemPrices[i] * itemQuantities[i];
}
return totalCost;
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.