-
-
Notifications
You must be signed in to change notification settings - Fork 654
Closed
Description
Tests say that the constant is defined incorrectly, but there's nothing wrong.
Code:
// @ts-check
/**
* The number of minutes it takes to prepare a single layer.
*/
const PREPARATION_MINUTES_PER_LAYER = 2;
const EXPECTED_MINUTES_IN_OVEN = 40;
/**
* Determines the number of minutes the lasagna still needs to remain in the
* oven to be properly prepared.
*
* @param {number} actualMinutesInOven
* @returns {number} the number of minutes remaining
*/
export function remainingMinutesInOven(actualMinutesInOven) {
return actualMinutesInOven <= EXPECTED_MINUTES_IN_OVEN ? EXPECTED_MINUTES_IN_OVEN - actualMinutesInOven : false;
}
/**
* Given a number of layers, determines the total preparation time.
*
* @param {number} numberOfLayers
* @returns {number} the total preparation time
*/
export function preparationTimeInMinutes(numberOfLayers) {
return numberOfLayers > 0 ? numberOfLayers * PREPARATION_MINUTES_PER_LAYER : false;
}
/**
* Calculates the total working time. That is, the time to prepare all the layers
* of lasagna, and the time already spent in the oven.
*
* @param {number} numberOfLayers
* @param {number} actualMinutesInOven
* @returns {number} the total working time
*/
export function totalTimeInMinutes(numberOfLayers, actualMinutesInOven) {
return preparationTimeInMinutes(numberOfLayers) + actualMinutesInOven;
}Metadata
Metadata
Assignees
Labels
No labels