Constant Real CALORIES_PER_MINUTE = 3.9 // main module Module main() // Local variables Declare Real calories_burned Declare Integer minutes // Set calories burned For minutes = 10 to 30 step 5 Call setCalories(minutes, calories_burned)
// Global constant for calories per minute
Constant Real CALORIES_PER_MINUTE = 3.9
// main module
Module main()
// Local variables
Declare Real calories_burned
Declare Integer minutes
// Set calories burned
For minutes = 10 to 30 step 5
Call setCalories(minutes, calories_burned)
// display values
Call showCalories(minutes, calories_burned)
End For
End Module
// The setCalories module calculates number of calories
// from a particular number of minutes.
Module setCalories (Integer minutes, Real Ref calories_burned)
Declare Real fminutes
// some languages require matched type variables for calculations
// this expression changes an Integer to a Real type
Set fminutes = minutes
// variables are now all of the same type
Set calories_burned = fminutes * CALORIES_PER_MINUTE
End Module
// The showCalories module accepts minutes and calories burned
// as arguments and displays amounts
Module showCalories (Integer minutes, Real calories_burned)
Display "In minutes: ", minutes
Display "Calories burned: ", calories_burned
End Module
I want flowchart for this please
Trending now
This is a popular solution!
Step by step
Solved in 2 steps