Add feat: challenge 4 for C# referesher

This commit is contained in:
Isaac Alter 2023-07-19 19:13:03 -06:00
parent 66100c7304
commit 7c8c6ac5c5
2 changed files with 38 additions and 0 deletions

View file

@ -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>

View 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.");
}