private void GetSlabs(ReadAutodesk cadFileReader) { List <LinearPath> lstPLine = CadHelper.PLinesGetByLayerName(cadFileReader, CadLayerName.Slab, true); for (int i = 0; i < lstPLine.Count; i++) { double width = double.MaxValue; double length = 0; List <Point2D> lstVertices = new List <Point2D>(); Point3D widthMidPt = Point3D.Origin; int nVertices = lstPLine[i].Vertices.Length; for (int j = 0; j < nVertices; j++) { if (j + 1 == nVertices) { break; } double dist = MathHelper.CalcDistanceBetweenTwoPoint3D(lstPLine[i].Vertices[j], lstPLine[i].Vertices[j + 1]); width = Math.Min(width, dist); if (width == dist) { widthMidPt = MathHelper.MidPoint3D(lstPLine[i].Vertices[j], lstPLine[i].Vertices[j + 1]); } length = Math.Max(length, dist); } Point3D center = MathHelper.MidPoint3D(lstPLine[i].Vertices[0], lstPLine[i].Vertices[2]); center.Z = Level; widthMidPt.Z = Level; Slabs.Add(new Slab(width, length, center, widthMidPt)); } }
public Slabs TaxDeduction(double gti) { Slabs slab = new Slabs(); // Calculating tax amount in every slab if no tax amount make it 0 slab.firstSlab = Math.Max((Math.Min(gti, 500000) - 250000), 0) * 0.05; slab.secondSlab = Math.Max((Math.Min(gti, 1000000) - 500000), 0) * 0.20; slab.thirdSlab = Math.Max((gti - 1000000), 0) * 0.30; slab.totalAmt = slab.firstSlab + slab.secondSlab + slab.thirdSlab; return(slab); }
static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\t\t\t\t Welcome To Income Tax Calculator \n\n"); double income; double deduction; // Calculate tax until user stops the program while (true) { Console.ForegroundColor = ConsoleColor.Gray; // Calling GetValue(message to print) function and storing the values income = GetValue("Enter your income in Rupees"); deduction = GetValue("Enter your 80C investment amount in Rupees"); // Object for calculating Gross Taxable Income and Tax for different slabs IncomeTax it = new IncomeTax(); double gti = it.GTI(income, deduction); Slabs ITax = it.TaxDeduction(gti); Display(ITax); // Check response of user for repeating process char response = 'p'; do { Console.WriteLine("\n\nDo you want to calculate your tax again ?(y/n)"); try { response = Convert.ToChar(Console.ReadLine()); response = Char.ToLower(response); } catch (Exception e) { Console.WriteLine("Invalid response \n" + e.Message); } } while (response != 'n' && response != 'y'); Console.WriteLine("\n\n"); if (response == 'n') { Environment.Exit(0); } } }
public static void Display(Slabs ITax) { // Display Tax amount slabwise // Converted amounts to string with Indian currency format Console.WriteLine("\nSlabs \t\t\t\t Amount per slabs"); Console.WriteLine("--------------------------------------------------------------"); Console.WriteLine("Rs. 2,50,000 - 5,00,000 \t Rs. {0}", ITax.firstSlab.ToString("#,0.00", new CultureInfo("hi-IN"))); Console.WriteLine("Rs. 5,00,000 - 10,00,000 \t Rs. {0}", ITax.secondSlab.ToString("#,0.00", new CultureInfo("hi-IN"))); Console.WriteLine("Rs. 10,00,000+ \t\t Rs. {0}", ITax.thirdSlab.ToString("#,0.00", new CultureInfo("hi-IN"))); Console.WriteLine("--------------------------------------------------------------"); Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Total amt \t\t\t Rs. {0}", ITax.totalAmt.ToString("#,0.00", new CultureInfo("hi-IN"))); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("--------------------------------------------------------------"); }
public void MixingSlabs() { IsMixing = true; int index = 0; int start = Player.Score + 1; int count = _countSpawned; int[] replacedNumbers = Enumerable.Range(start, count).ToArray(); replacedNumbers.GenerateEnum(0, count); var search = Slabs.ToList().Where(x => x.IsAlive == true); foreach (var slab in search) { slab.SetupNewIndex(replacedNumbers[index]); index++; } IsMixing = false; }
public void OnSlabClicked(int index) { if (!IsGameStart) { IsGameStart = true; } var slab = Slabs.ToList().Where(x => x.Index == index).SingleOrDefault(); if (_currentIndex == index) { slab.Kill(); _countSpawned--; _currentIndex++; Player.AddScore(1); if (Player.Score > 0 && Player.Score % 10 == 0) { MixingSlabs(); } //if(_countSpawned < 10 && Random.Range(0, 100) < 20) // TeleportSlabs(); return; } else if (slab.CanInteract) { Player.ApplyDamageToHealth(1); if (Player.HealthPoint == 0) { Lose(); } } }
public void RescaleSlabs() { Slabs.ForEach(s => s.Points = s.RawPoints.Select(p => new MWPoint2D(p.X * PlaneScaling, p.Y * PlaneScaling)).ToList()); }