mirror of
https://github.com/dotnet/intro-to-dotnet-web-dev.git
synced 2025-12-06 05:32:03 +01:00
Add feat: challenge 4 for C# referesher
This commit is contained in:
parent
66100c7304
commit
7c8c6ac5c5
|
|
@ -0,0 +1,10 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
28
2-csharp/lesson-2-projects/CsharpProjects/Program.cs
Normal file
28
2-csharp/lesson-2-projects/CsharpProjects/Program.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
Random random = new Random();
|
||||||
|
int daysUntilExpiration = random.Next(12);
|
||||||
|
int discountPercentage = 0;
|
||||||
|
|
||||||
|
Console.WriteLine(daysUntilExpiration);
|
||||||
|
|
||||||
|
if (daysUntilExpiration <= 10 && daysUntilExpiration > 5)
|
||||||
|
{
|
||||||
|
discountPercentage = 0;
|
||||||
|
Console.Write("Your subscription will expire soon. Renew now!");
|
||||||
|
}
|
||||||
|
else if (daysUntilExpiration <= 5 && daysUntilExpiration > 1)
|
||||||
|
{
|
||||||
|
discountPercentage = 10;
|
||||||
|
Console.WriteLine("Your subscription expires in " + daysUntilExpiration + " days.");
|
||||||
|
Console.Write("Renew now and save " + discountPercentage + "%!");
|
||||||
|
}
|
||||||
|
else if (daysUntilExpiration == 1)
|
||||||
|
{
|
||||||
|
discountPercentage = 20;
|
||||||
|
Console.WriteLine("Your subscription expires in a day!");
|
||||||
|
Console.Write("Renew now and save " + discountPercentage + "%!");
|
||||||
|
}
|
||||||
|
else if (daysUntilExpiration < 1)
|
||||||
|
{
|
||||||
|
discountPercentage = 0;
|
||||||
|
Console.WriteLine("Your subscription has expired.");
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue