60.5k views
1 vote
Write a value function called sugarScaled with the following three parameters: A real-number scale that defaults to 1.7.

A whole-number naturalSugarLevel that is a sugar amount in grams.
A whole-number artificialSugarLevel that is a sugar amount in grams.
The function adds the two sugar levels, multiplies the sum by the scale, and returns that value from the function.

1 Answer

6 votes

Step-by-step explanation:

const double scale = 1.7;

int sugarScaled(double scale, int naturalSugarLevel, int artifiialSugarLevel){

return scale * (naturalSugarLevel + artifiialSugarLevel);

}

User Spike
by
5.5k points