#C# Lucian's Luscious Lasagna Learning Task

74 messages Β· Page 1 of 1 (latest)

covert tulip
#

Could you please share the code and the test output using a codeblock and not an image?

cursive shardBOT
turbid bramble
#
class Lasagna
{
    // TODO: define the 'ExpectedMinutesInOven()' method
    public int ExpectedMinutesInOven(){        
        return 40;        
    }   

    // TODO: define the 'RemainingMinutesInOven()' method
    public int RemainingMinutesInOven(int number){
        return ExpectedMinutesInOven() - number;
    }

    // TODO: define the 'PreparationTimeInMinutes()' method
    public int PreparationTimeInMinutes(int number){
        return number * 2;
    }

    // TODO: define the 'ElapsedTimeInMinutes()' method    
    public int ElapsedTimeInMinutes(int layers, int oven){
        int number = PreparationTimeInMinutes(layers);
        int number2 = RemainingMinutesInOven(oven);            
        return number + number2;
    }
}
#

Code Run:

Assert.Equal(2, new Lasagna().PreparationTimeInMinutes(1));
Test Failure:

Assert.Equal() Failure: Values differ
Expected: 2
Actual:   3
#

ah got it

covert tulip
#

Could you kindly edit that code post and change your triple quotes ''' to backticks ```?

turbid bramble
#

yea sorry did it wrong

covert tulip
covert tulip
turbid bramble
#

the exercise

#

the last one is false

#

but i pressed on that im stuck but i didnt helped me

#

so now i need more help haha

#

the rest is correct

#

so just the part with the ElapsedTimeInMinutes() method

covert tulip
#

How do you calculate elapsed time? What goes into figuring out how much time has already passed?

turbid bramble
#

It’s on in my code above or πŸ™‚

covert tulip
#

I meant, can you explain it in English

#

The code fails the tests so it's not doing the right thing πŸ˜‰ I'm trying to focus on figuring out the right thing.

turbid bramble
#

ahhh ok gotchu πŸ™‚

#

yea wait a sec i go to shower really quick

covert tulip
#

Okay. I'm waiting.

turbid bramble
#

ok sry took a bit longer

#

elasped time = out of the two numbers of the parameters

covert tulip
#

Uh... in English. Imagine you're in a kitchen making a lasagna and someone asks how much time elapsed. How do you determine that?

#

Stop thinking about the code. Think about the problem.

turbid bramble
#

i just stop the time or ? πŸ˜„

#

so i have a timer and check when time is over

#

first method is 40 min

covert tulip
#

Hah. You're assuming there'sa timer in the kitchen πŸ™‚

#

What if the timer was started when the lasagna went into the oven.

#

You know (1) how many layers the lasagna has and (2) how long it's been in the oven.

#

Given (1) and (2), how would you tell how long you've been working on the lasagna?

turbid bramble
#

(1) * (2) ?

#

no every layer takes two min

covert tulip
#

If there are 5 layers and it's been in the oven for 10 minutes ... that's a total of 50 minutes?

#

So, if there are 5 layers and it's been in the oven for 10 minutes, how much time has passed?

turbid bramble
#

10 min

#

so 30 min left or

#

if cooking book says 40 min in general

covert tulip
#

The question isn't how much time is left πŸ™‚

#

The question is, how long have you been in the kitchen working on the lasagna.

#

If there are 5 layers and it's been in the oven for 10 minutes, how long have you been in the kitchen?

turbid bramble
#

20 min

#

so 20 min left

covert tulip
#

How did you get that number?

#

We don't care how much time is left πŸ™‚

#

I'm not sure why you keep bringing up time left

turbid bramble
#

2*5 because for each layer 2min

#

or

covert tulip
#

Uh huh. 2*5 is 10.

turbid bramble
#

yes

covert tulip
#

So 10 minutes passed? Or 20?

turbid bramble
#

2 min preperation for each layer

#

and when its 10 min in oven yea then its 20 min

#

10 +10

covert tulip
#

Sounds about right. Can you explain that all (how you get time that passed) in a single sentence?

turbid bramble
#

so when i use PreparationTimeInMinutes() i get the time for the preperation

covert tulip
#

Can you explain, in English, how you'd figure out the time that passed based on the number of layers and how long it's been in the oven?

#

English first before code πŸ˜‰

turbid bramble
#
public int ElapsedTimeInMinutes(int layers, int oven){  
        return PreparationTimeInMinutes(layers) + ExpectedMinutesInOven() - RemainingMinutesInOven(oven);
    }
covert tulip
#

Can you explain, in English, how you'd figure out the time that passed based on the number of layers and how long it's been in the oven?

turbid bramble
#

it was a logic mistake by me because my english is not so good haha i swap the meaning of remaining and elapsed

covert tulip
#

πŸ‘

#

Note, your code doesn't match what you described above and is more complicated than it ought to be

turbid bramble
#
public int ElapsedTimeInMinutes(int layers, int oven){          
        return (layers * 2) + oven;
    }
covert tulip
#

That looks much more reasonable.

#

Always start with English (or your native language) before code.

#

2 min preperation for each layer and when its 10 min in oven yea then its 20 min
10 +10
This translates pretty well to that code.

turbid bramble
#

ok thank you so much for helping sure im back tomorrow

#

with a new task

#

πŸ˜„

covert tulip
#

You're very welcome

turbid bramble
#

tysm !