Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions solutions/cpp/lasagna/1/lasagna.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ovenTime returns the amount in minutes that the lasagna should stay in the
// oven.
int ovenTime() {
// TODO: Return the correct time.
return 40;
}

/* remainingOvenTime returns the remaining
minutes based on the actual minutes already in the oven.
*/
int remainingOvenTime(int actualMinutesInOven) {
// TODO: Calculate and return the remaining in the oven based on the time
// the lasagna has already been there.
int result = ovenTime() - actualMinutesInOven;
return result;
}

/* preparationTime returns an estimate of the preparation time based on the
number of layers and the necessary time per layer.
*/
int preparationTime(int numberOfLayers) {
// TODO: Calculate and return the preparation time with the
// `numberOfLayers`.
return 2 * numberOfLayers;
}

// elapsedTime calculates the total time spent to create and bake the lasagna so
// far.
int elapsedTime(int numberOfLayers, int actualMinutesInOven) {
// TODO: Calculate and return the total time so far.
int cookLayers = preparationTime(numberOfLayers);
int result = cookLayers + actualMinutesInOven;
return result;
}