public static void Main(string[] args) { Frete x = new Frete(10, 20); //x.SetPeso(10); //x.SetDistancia(20); Console.WriteLine(x.ToString()); }
public static void Main(string[] args) { Frete x = new Frete { Distancia = 10, Peso = 5 }; Console.WriteLine(x.ToString()); }
public static void Main(string[] args) { Frete f = new Frete(0, 0); Console.WriteLine("Qual a distância percorrida (em km)?"); f.SetDistancia(int.Parse(Console.ReadLine())); Console.WriteLine("Qual o peso da carga (em kg)?"); f.SetPeso(int.Parse(Console.ReadLine())); Console.WriteLine($"O frete é R${f.CalcFrete():0.00}"); Console.WriteLine(f.ToString()); }
private void calcularCustos(Regra regra) { Double txComissao = 0, alq1, alq2, custo, Vd1, Vd2, Frete, federal1, federal2, ICMSD1, ICMSD2, ICMSC, alICMSC, IPI, LB1, LB2, LL1, LL2, TXFixa1, TXFixa2, comissao1, comissao2; custo = Convert.ToDouble(txtCusto.Text.ToString()); alq1 = Convert.ToDouble(txtaliq1.Text.ToString()); Vd1 = Convert.ToDouble(txtvalor1.Text.ToString()); //Fazendo o valor 2 em relação ao desconto. Vd2 = (Convert.ToDouble(txtvalor1.Text.ToString()) - ((Convert.ToDouble(txtDesconto.Text.ToString()) / 100) * Convert.ToDouble(txtvalor1.Text.ToString()))); alq2 = (((Vd2 - custo) * 100) / custo); txtvalor2.Text = Vd2.ToString("N"); txtaliq2.Text = alq2.ToString("N"); Frete = Convert.ToDouble(txtCusto.Text.ToString()) * ((Convert.ToDouble(txtFrete.Text.ToString())) / 100); federal1 = Vd1 * (regra.getFederal() / 100); federal2 = Vd2 * (regra.getFederal() / 100); alICMSC = Convert.ToDouble(txtIcms.Text.ToString()); IPI = custo * (Convert.ToDouble(txtIPI.Text.ToString()) / 100); LB1 = custo * (alq1 / 100); LB2 = custo * (alq2 / 100); TXFixa1 = Vd1 * (regra.getTaxaDespesasFixas() / 100); TXFixa2 = Vd2 * (regra.getTaxaDespesasFixas() / 100); ICMSC = custo * ((18 - alICMSC) / 100); // Mudar quando não usar mais aliquotas negativas para ICMSC //Deve-se prepara a regra para Normal e SuperSimples, neste caso só apresentarei o superSimples ICMSD1 = 0; ICMSD2 = 0; txComissao = (txtComissao.Text.Equals("")) ? 0 : (Convert.ToDouble(txtComissao.Text) / 100); comissao1 = txComissao * Vd1; comissao2 = txComissao * Vd2; LL1 = Vd1 - (custo + Frete + federal1 + IPI + ICMSC + ICMSD1 + TXFixa1 + comissao1); LL2 = Vd2 - (custo + Frete + federal2 + IPI + ICMSC + ICMSD2 + TXFixa2 + comissao2); Labfrete1.Text = Frete.ToString("N"); Labfrete2.Text = Frete.ToString("N"); LabICMS0.Text = (ICMSC + ICMSD1).ToString("N"); LabICMS1.Text = (ICMSC + ICMSD2).ToString("N"); LabFederal1.Text = federal1.ToString("N"); LabFederal2.Text = federal2.ToString("N"); LabIPI1.Text = IPI.ToString("N"); LabIPI2.Text = IPI.ToString("N"); LabLB1.Text = LB1.ToString("N"); LabLB2.Text = LB2.ToString("N"); LabFixa1.Text = TXFixa1.ToString("N"); LabFixa2.Text = TXFixa2.ToString("N"); LabLL1.Text = (LL1 < 0)? "<font color ='red'>" + LL1.ToString("N") + "</font>" : LL1.ToString("N"); LabLL2.Text = (LL2 < 0) ? "<font color ='red'>" + LL2.ToString("N") + "</font>" : LL2.ToString("N"); labComissao1.Text = comissao1.ToString("N"); labComissao2.Text = comissao2.ToString("N"); }