#Lasagna Receipt JS

55 messages · Page 1 of 1 (latest)

spare prairie
#

You're function is supposed to return the number of minutes left

torpid hazel
spare prairie
#

Given the number of minutes ahead in the oven, return the remaining minutes in the oven

torpid hazel
#

I can't understand the code, i tried but can't get it. My last try was this code

  return actualMinutesInOven;
}```
spare prairie
#

The total time should be 40 minutes. If the lasagna was already in the oven for 30 minutes, then there are 10 minutes remaining.

#

Are you having trouble understanding code or the instructions?

torpid hazel
#

code

spare prairie
#

What code? You're supposed to write your own code which implements the requirements.

torpid hazel
#

i don't know what i'm suposed to write

spare prairie
#

Do you understand the requirements? What should the code look like to implement those requirements?

#

Can you write instructions in English that implements the requirements?

#

It's not very helpful to write code before understanding what the code is supposed to be doing

torpid hazel
spare prairie
#

Please use codeblocks to share text. Images are hard to read.

torpid hazel
#

i wrote the const = 40, all the other code is the exercise, could you tell me how to proceed?

spare prairie
#

You're supposed to write instructions which, given the actualMinutesInOven will return the remainingMinutesInOven. How would you figure that out, using English to write the instructions?

#

" @torpid hazel , I know how long my lasagna was in the oven. I need to know how many minutes remain. How do I figure that out?"

#

Imagine your mom asked you that. How do you respond?

torpid hazel
#

yeah, its been 20 minutes in the oven, so there remain 20 more

spare prairie
#

You don't know how many minutes it's been, but your mom does. How can she figure out how much time remains?

torpid hazel
#

due to the time required - the actual time

spare prairie
#

So if it's been in the oven for 5 minutes (actual time), then 5 minutes remain?

torpid hazel
#

35 minutes remain

spare prairie
#

How do I figure that out, though?

torpid hazel
#

40-5=35

spare prairie
#

What steps do I take?

#

Give me instructions

#

You need to write steps, not an answer. Your mom wants to know how to figure out how much time is left without telling you how long it's been in the oven.

torpid hazel
#

to know the time left substract the actual time to the remaining time

spare prairie
#

Subtract what from what? I have the actual time. What do I do with it?

#

A - B = C
What are A, B, C?

torpid hazel
#

receipt time - actual time = remaining

spare prairie
#

What is receipt time?

torpid hazel
#

40

#

preparationTimeInMinutes

spare prairie
#

So ... 40 - actual = remaining?

torpid hazel
spare prairie
#

Can you write code that does that?

torpid hazel
#

no!

#

i can't that's why i'm asking

spare prairie
#

Can you try?

#

You have actualMinutesInOven and you need remaining

torpid hazel
#

and what parameter is the "40"

#

or i don't need to call it?

spare prairie
#

I think 40 is a number

#

40 - actual = remaining

#

Or so you told me a minute ago

#

Let's assume that's correct for now. Given that 40 - actual = remaining, can you write code that uses actualMinutesInOven to get the remaining time.

torpid hazel
#
export function remainingMinutesInOven(actualMinutesInOven) {
  throw new Error(remainingMinutesInOven = 40 - actualMinutesInOven);
}```
#

idk how to say to you i don't understand what i'm writting

spare prairie
#

You got the equation in there. That's better. Do you want to throw an error?

torpid hazel
#

i dont know what is throw error

#

i've not been introduced to that

spare prairie
#

Maybe you should read an intro to programming first

torpid hazel
#

maybe, you have that?