Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Accessit SalaryCalculation
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { DateTime ss1, ss2; DateTime sfc; DateTime stc; TimeSpan ts1; TimeSpan ts2; //Your code goes here Console.WriteLine("Senario1:"); ss1 = new DateTime(2015, 05, 01); ss2 = new DateTime(2016, 05, 03); sfc = new DateTime(2016, 03, 21); stc = new DateTime(2016, 04, 21); if(sfc< ss2 && stc< ss2) { Console.WriteLine("Normal Calculation with ss1"); } else if(sfc > ss2 && stc > ss2) { Console.WriteLine("Normal Calculation with ss2"); } else { ts1= ss2.Subtract(sfc); ts2= stc.Subtract(ss2); Console.WriteLine("ss2-sfc: {0} days , stc-ss2: {1} days", ts1.TotalDays, ts2.TotalDays); } Console.WriteLine("Senario2:"); ss1 = new DateTime(2015, 05, 01); ss2 = new DateTime(2016, 05, 03); sfc = new DateTime(2016, 05, 21); stc = new DateTime(2016, 06, 20); if(sfc< ss2 && stc< ss2) { Console.WriteLine("Normal Calculation with ss1"); } else if(sfc > ss2 && stc > ss2) { Console.WriteLine("Normal Calculation with ss2"); } else { ts1= ss2.Subtract(sfc); ts2= stc.Subtract(ss2); Console.WriteLine("ss2-sfc: {0} days , stc-ss2: {1} days", ts1.TotalDays, ts2.TotalDays); } Console.WriteLine("Senario3:"); ss1 = new DateTime(2015, 05, 01); ss2 = new DateTime(2016, 05, 03); sfc = new DateTime(2016, 04, 21); stc = new DateTime(2016, 05, 20); if(sfc< ss2 && stc< ss2) { Console.WriteLine("Normal Calculation with ss1"); } else if(sfc > ss2 && stc > ss2) { Console.WriteLine("Normal Calculation with ss2"); } else { ts1= ss2.Subtract(sfc); ts2= stc.Subtract(ss2); //int span= Convert.ToInt32(ts2.ToString())+1; Console.WriteLine("Calculate ss2-sfc: {0} days with ss1 , Calculate stc-ss2: {1} days with ss2", ts1.TotalDays, ts2.TotalDays); } } } }
run
|
edit
|
history
|
help
0
Count vowels in a string
Problem 5 SingleDigit
Bb
actions and tasks
Chest Interaction Unity
Const
transform string to hex code
Linq FirstOrDefault() null check in c#
DN3
Binary search tree - In-order Traversal