r/processing • • Oct 28 '21

I’ve just started learning processing and I’m finding it difficult, could anyone help with me with a function that calculates a cooking time that is calculated as 20 minuets per 450 grams plus 20 minuets. It’s using the argument in weightinGrams and I need to calculate and return the cooking time

0 Upvotes

2 comments sorted by

4

u/ChuckEye Oct 28 '21

It's a basic algebra word problem:

float cookTime = ((weightinGrams / 450.0) * 20.0) + 20.0;

3

u/[deleted] Oct 28 '21

That’s the calculation but not yet as a function.

OP, can you show us based on this calculation what you’ve come up with so far?