So, i got to the second problem of the C# course, i made a program that works perfectly on my PC:
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
namespace Lasagna1
{
internal class Program
{
static void Main(string[] args)
{
int y = 20;
// Example usage
Console.WriteLine("Expected Minutes in Oven: " + Lasagna.ExpectedMinutesInOven());
Console.WriteLine("Remaining Minutes in Oven: " + Lasagna.RemainingMinutesInOven(y));
Console.WriteLine("Preparation Time for 3 layers: " + Lasagna.PreparationTimeInMinutes(3));
Console.WriteLine("Elapsed Time (3 layers, 20 mins in oven): " + Lasagna.ElapsedTimeInMinutes(3, y));
}
}
class Lasagna
{
// 1. Expected total oven time in minutes
public static int ExpectedMinutesInOven()
{
return 40;
}
// 2. Remaining time in oven based on time already in oven
public static int RemainingMinutesInOven(int x)
{
return ExpectedMinutesInOven() - x;
}
// 3. Preparation time: 2 minutes per layer
public static int PreparationTimeInMinutes(int layers)
{
return layers * 2;
}
// 4. Elapsed time = preparation + time in oven
public static int ElapsedTimeInMinutes(int layers, int x)
{
return PreparationTimeInMinutes(layers) + x;
}
}
}
It doesnt work on the site's editor and i dont know how to resolve it locally to send it like that. I find it a bit discouraging that the site forces you to resolve a program the way it wants, considering you can resolve something in unlimited ways. And now i cant advance in the course