diff --git a/2-csharp/lesson-2-projects/CsharpProjects/CsharpProjects.csproj b/2-csharp/lesson-2-projects/CsharpProjects/CsharpProjects.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/2-csharp/lesson-2-projects/CsharpProjects/CsharpProjects.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/2-csharp/lesson-2-projects/CsharpProjects/Program.cs b/2-csharp/lesson-2-projects/CsharpProjects/Program.cs new file mode 100644 index 0000000..20e01e6 --- /dev/null +++ b/2-csharp/lesson-2-projects/CsharpProjects/Program.cs @@ -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."); +} \ No newline at end of file