Exemplo n.º 1
0
        public void SetUp()
        {
            DateTime testStart       = new DateTime(2018, 7, 6, 14, 0, 0);
            DateTime testEnd         = new DateTime(2018, 7, 6, 20, 0, 0);
            int      testCostPerHour = 10;

            var paymentBoundary = new PaymentBoundary(testStart, testEnd, testCostPerHour);

            DateTime testStart2       = new DateTime(2018, 7, 6, 20, 0, 0);
            DateTime testEnd2         = new DateTime(2018, 7, 6, 22, 0, 0);
            int      testCostPerHour2 = 20;

            var paymentBoundary2 = new PaymentBoundary(testStart2, testEnd2, testCostPerHour2);

            DateTime testStart3       = new DateTime(2018, 7, 6, 22, 0, 0);
            DateTime testEnd3         = new DateTime(2018, 7, 7, 4, 0, 0);
            int      testCostPerHour3 = 30;

            var paymentBoundary3 = new PaymentBoundary(testStart3, testEnd3, testCostPerHour3);

            boundaries = new List <PaymentBoundary>
            {
                { paymentBoundary },
                { paymentBoundary2 },
                { paymentBoundary3 }
            };

            sut = new PaymentCalculator(boundaries);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ValidateArguments(args);

            var parameters = new LoanParameters
            {
                LoanAmount   = Decimal.Parse(args[0]),
                Term         = Int32.Parse(args[1]),
                InterestRate = Decimal.Parse(args[2]),
                PayDay       = Int32.Parse(args[3])
            };

            var calculator = new PaymentCalculator(parameters);
            var graph      = calculator.GetPaymentGraph();
            var i          = 1;

            Console.WriteLine("Įmokos Nr.\t | Data\t\t |  Likutis prieš įmoką\t | Kredito dalis\t | Palūkanos\t | Įmoka\t | Likutis po įmokos");
            foreach (var g in graph.PaymentEntries)
            {
                var str = $"{i}\t\t | {g.Date.ToString("yyyy-MM-dd")}\t | {g.RemainderBeforePayment:0.00}\t\t | {g.CreditPart:0.00}\t\t |" +
                          $" {g.InterestPart:0.00}\t | {g.Payment:0.00}\t | {g.RemainderAfterPayment:0.00}";

                Console.WriteLine(str);
                i++;
            }

            //PrintTotals(graph);
            var bv = new BVKKMNCalculator(parameters.Term, graph.PaymentEntries.FirstOrDefault().Payment, parameters.LoanAmount).Calculate() * 100;

            Console.WriteLine($"BVKKMN - {bv:0.00}");
        }
Exemplo n.º 3
0
        public void GenerateOutput()
        {
            Confidence confidence = new Confidence(carlo.trialsList);

            confident75          = confidence.FindInterval(75);
            confident90          = confidence.FindInterval(90);
            amountAtRetirement75 = confident75[confident75.Count - 1];
            amountAtRetirement90 = confident90[confident90.Count - 1];
            int    yearsOfPayments  = (person.deathDate - person.retirementDate);
            double currentAmmount75 = amountAtRetirement75;
            double currentAmmount90 = amountAtRetirement90;
            double totalAmount;

            if (yearsOfLife == null)
            {
                yearsOfLife = yearsOfPayments;
            }

            growth75 = ((amountAtRetirement75 / confident75[0]) - 1) / (person.retirementDate - DateTime.Now.Year);
            growth90 = ((amountAtRetirement90 / confident90[0]) - 1) / (person.retirementDate - DateTime.Now.Year);

            withdrawl75 = Math.Round(PaymentCalculator.GetPayments(amountAtRetirement75, growth75, yearsOfPayments + 1), 2);
            withdrawl90 = Math.Round(PaymentCalculator.GetPayments(amountAtRetirement90, growth90, yearsOfPayments + 1), 2);

            totalAmount    = withdrawl75 * yearsOfPayments;
            exclusionRatio = person.lumpSum / totalAmount;
        }
Exemplo n.º 4
0
        public AssetFactory(AssetModel assets, int retirementDate, int deathDate, double income)
        {
            int currentYear       = DateTime.Now.Year;
            int yearsToRetirement = retirementDate - currentYear;
            int yearsOfRetirement = deathDate - retirementDate;

            try
            {
                double additions    = double.Parse(assets.additions[0]);
                double currentValue = double.Parse(assets.amounts[0]);

                additions += Math.Min(((double.Parse(assets.matching[0]) / 100) * additions), ((double.Parse(assets.caps[0]) / 100) * income * (double.Parse(assets.matching[0]) / 100)));

                for (int i = yearsToRetirement; i > 0; i--)
                {
                    currentValue += (currentValue * rate);
                    currentValue += additions;
                }

                yearlyIncome = PaymentCalculator.GetPayments(currentValue, rate, yearsOfRetirement);
            }
            catch (ArgumentOutOfRangeException exception)
            {
                Console.WriteLine(exception);
                yearlyIncome = 0;
            }
        }
Exemplo n.º 5
0
        public void CalculateBrokerageData(Brokerage stock)
        {
            rate -= extraFees;

            distributionsBeforeTax = PaymentCalculator.GetPayments(lumpSumAtRetirement, rate, yearsOfPayments);
            totalExpectedReturn    = distributionsBeforeTax * yearsOfPayments;

            //exclusion ratio is only non-zero if it a nonqualified annuity
            if (annuityTax == AnnuityTax.Nonqualified)
            {
                exclusionRatio = initialAmount / totalExpectedReturn;
            }
            else
            {
                exclusionRatio = 0;
            }

            CalculateRiders();
            CalculateTaxes();

            yearlyBreakdown = GetYearlyBreakdown(stock);
            if (annuityTax == AnnuityTax.Nonqualified)
            {
                afterTaxIncome = distributionsBeforeTax * (1 - taxRate) + yearlyNonTaxable;
            }
            else
            {
                afterTaxIncome = distributionsBeforeTax * (1 - taxRate);
            }

            afterTaxIncome = Math.Round(afterTaxIncome, 2);
            assetValue     = Math.Max(person.assetIncome * (1 - taxRate), 0);
            Math.Round(assetValue, 2);
        }
Exemplo n.º 6
0
        private void calculateYearsOfAdditions(List <double> rate)
        {
            List <Yearly> yearlies     = new List <Yearly>(yearsOfAdditions + yearsOfWithdrawls);
            double        currentValue = initialAmount;
            double        previousYear;

            for (int i = 0; i < yearsOfAdditions; i++)
            {
                currentValue += additions;
                currentValue += currentValue * rate[i];
                currentValue  = Math.Max(currentValue, 0);
                yearlies.Add(new Yearly(Math.Round(currentValue, 2), Math.Round(additions, 2), Math.Round(rate[i], 4)));
            }
            for (int i = yearsOfAdditions; i < yearsOfWithdrawls + yearsOfAdditions; i++)
            {
                previousYear  = currentValue;
                withdrawls    = PaymentCalculator.GetPayments(previousYear, rate[i], (yearsOfWithdrawls + yearsOfAdditions) - i);
                withdrawls    = Math.Max(withdrawls, 0);
                currentValue += currentValue * rate[i];
                currentValue -= withdrawls;
                currentValue  = Math.Max(currentValue, 0);
                yearlies.Add(new Yearly(Math.Round(currentValue, 2), Math.Round(-withdrawls, 2), Math.Round(rate[i], 4)));
            }

            mutex.WaitOne();
            Allpercentiles.Add(new Percentiles(yearlies));
            mutex.ReleaseMutex();
        }
 public PaymentCalculatorTests()
 {
     _calculator = new PaymentCalculator();
     _payments   = new List <Payment>();
     _payments.Add(new Payment(004, 200, Category.Entertainment, 0));
     _payments.Add(new Payment(004, 200, Category.Entertainment, 0));
     _payments.Add(new Payment(004, 200, Category.Entertainment, 1));
 }
        public ActionResult <GetPaymentAmountResult> GetPaymentAmount([FromBody] GetPaymentAmountInput input)
        {
            var interestRate      = new InterestRate(this.Configuration);
            var paymentCalculator = new PaymentCalculator(input, interestRate.Rate);

            return(new GetPaymentAmountResult {
                PaymentAmount = paymentCalculator.Calculate()
            });
        }
Exemplo n.º 9
0
 static void DisplayLoanInformation(PaymentCalculator calculator)
 {
     Console.WriteLine("Purchase Price: {0:C}", calculator.PurchasePrice);
     Console.WriteLine("Down Payment: {0:C}", calculator.DownPayment);
     Console.WriteLine("Loan Amount: {0:C}", calculator.LoanAmount);
     Console.WriteLine("Annual Interest Rate: {0}%", calculator.InterestRate);
     Console.WriteLine("Term: {0} years ({1} months)", calculator.LoanTermYears, calculator.LoanTermMonths);
     Console.WriteLine("Monthly Payment: {0:C}", calculator.CalculatePayment());
     Console.WriteLine();
 }
Exemplo n.º 10
0
 public PaymentController(PaymentCalculator paymentCalculator,
                          IOptions <CloudFoundryApplicationOptions> appOptions,
                          IHitCountService hitCountService,
                          ILogger <PaymentController> logger)
 {
     PaymentCalculator = paymentCalculator;
     AppOptions        = appOptions.Value;
     HitCountService   = hitCountService;
     _logger           = logger;
 }
Exemplo n.º 11
0
        public decimal LoanPayment(decimal purchaseprice, decimal interestRate, double loanyears)
        {
            var pCalculator = new PaymentCalculator
            {
                PurchasePrice = purchaseprice,
                InterestRate  = interestRate,
                LoanTermYears = loanyears
            };

            return(pCalculator.CalculatePayment());
        }
Exemplo n.º 12
0
        private void Initialize()
        {
            Name  = Name ?? "Default Name";
            Years = Math.Max(1, Years);

            HomePurchaseAmount = Math.Max(1m, HomePurchaseAmount).ToDollars();

            OwnerDownPaymentPercentage = Math.Min(Math.Max(0m, OwnerDownPaymentPercentage), 100).ToPercent();
            OwnerDownPayment           = (HomePurchaseAmount * OwnerDownPaymentPercentage).ToDollars();
            OwnerInterestRatePerYear   = Math.Min(Math.Max(0m, OwnerInterestRatePerYear), 100).ToPercent();
            OwnerLoanAmount            = HomePurchaseAmount - OwnerDownPayment;
            OwnerLoanYears             = Math.Max(1, OwnerLoanYears);
            OwnerMonthlyPayment        = PaymentCalculator.CalculatePayment(OwnerLoanAmount, OwnerInterestRatePerYear, OwnerLoanYears);

            LandlordDownPaymentPercentage           = LandlordDownPaymentPercentage ?? OwnerDownPaymentPercentage;
            LandlordDownPaymentPercentage           = Math.Min(Math.Max(0m, LandlordDownPaymentPercentage.Value), 100).ToPercent();
            LandlordDownPayment                     = (HomePurchaseAmount * LandlordDownPaymentPercentage.Value).ToDollars();
            LandlordInterestRatePerYear             = LandlordInterestRatePerYear ?? OwnerInterestRatePerYear;
            LandlordInterestRatePerYear             = Math.Min(Math.Max(0m, LandlordInterestRatePerYear.Value), 100).ToPercent();
            LandlordManagementFeePercentagePerMonth = Math.Min(Math.Max(0m, LandlordManagementFeePercentagePerMonth), 100).ToPercent();
            LandlordVacancyFeePercentage            = Math.Min(Math.Max(0m, LandlordVacancyFeePercentage), 100).ToPercent();
            LandlordLoanAmount     = HomePurchaseAmount - LandlordDownPayment;
            LandlordLoanYears      = Math.Max(1, LandlordLoanYears ?? OwnerLoanYears);
            LandlordMonthlyPayment = PaymentCalculator.CalculatePayment(LandlordLoanAmount, LandlordInterestRatePerYear.Value, LandlordLoanYears.Value);

            DiscountRatePerYear     = Math.Min(Math.Max(0m, DiscountRatePerYear), 100).ToPercent();
            CapitalGainsRatePerYear = Math.Min(Math.Max(0m, CapitalGainsRatePerYear), 100).ToPercent();
            MarginalTaxRatePerYear  = Math.Min(Math.Max(0m, MarginalTaxRatePerYear), 100).ToPercent();
            InflationRatePerYear    = Math.Min(Math.Max(0m, InflationRatePerYear), 100).ToPercent();

            BuyerFixedCosts = Math.Max(0m, BuyerFixedCosts).ToDollars();
            BuyerVariableCostsPercentage = Math.Min(Math.Max(0m, BuyerVariableCostsPercentage), 100).ToPercent();
            PropertyTaxPercentagePerYear = Math.Min(Math.Max(0m, PropertyTaxPercentagePerYear), 100).ToPercent();
            InsurancePerMonth            = Math.Max(0m, InsurancePerMonth).ToDollarCents();
            HoaPerMonth = Math.Max(0m, HoaPerMonth).ToDollarCents();
            HomeAppreciationPercentagePerYear = Math.Min(Math.Max(0m, HomeAppreciationPercentagePerYear ?? InflationRatePerYear), 100).ToPercent();
            HomeMaintenancePercentagePerYear  = Math.Min(Math.Max(0m, HomeMaintenancePercentagePerYear), 100).ToPercent();
            SellerCommissionPercentage        = Math.Min(Math.Max(0m, SellerCommissionPercentage), 100).ToPercent();
            SellerFixedCosts      = Math.Max(0m, SellerFixedCosts).ToDollars();
            DepreciationYears     = Math.Max(1, DepreciationYears).ToValue();
            DepreciablePercentage = Math.Min(Math.Max(0m, DepreciablePercentage), 100).ToPercent();

            RentChangePerYearPercentage = Math.Min(Math.Max(0m, RentChangePerYearPercentage ?? HomeAppreciationPercentagePerYear ?? InflationRatePerYear), 100).ToPercent();
            var defaultRent =
                OwnerMonthlyPayment +
                InsurancePerMonth +
                HoaPerMonth +
                HomePurchaseAmount * PropertyTaxPercentagePerYear / 12 +
                HomePurchaseAmount * HomeMaintenancePercentagePerYear / 12;

            RentPerMonth              = Math.Max(1m, RentPerMonth ?? defaultRent).ToDollars();
            RentersInsurancePerMonth  = Math.Max(0m, RentersInsurancePerMonth).ToDollarCents();
            RentSecurityDepositMonths = Math.Max(0, RentSecurityDepositMonths);
        }
Exemplo n.º 13
0
        public void VerifyNegativeScenarious(LoanDetails input)
        {
            //Arrange
            var calculator = new PaymentCalculator();

            //Act
            Action result = () => calculator.Calculate(input);

            //Assert
            Assert.Throws <ArgumentException>(result);
        }
Exemplo n.º 14
0
        public void VerifyArgumentIsNullScenario()
        {
            //Arrange
            var calculator = new PaymentCalculator();

            //Act
            Action result = () => calculator.Calculate(null);

            //Assert
            Assert.Throws <ArgumentNullException>(result);
        }
        public void GivenAnHourlyRate_ShouldYieldGrossPayment()
        {
            decimal hourlyRate  = 10.00m;
            decimal hoursWorked = 40.0m;

            double expectedGrossPay = 400.00;

            var calculator = new PaymentCalculator();
            var grossPay   = calculator.calculateGrossPay(hourlyRate, hoursWorked);

            Assert.AreEqual(expectedGrossPay, grossPay);
        }
        public void PaymentCalculatorTest()
        {
            const decimal compareamount = (decimal)966.64;
            var           paymentcalc   = new PaymentCalculator();

            paymentcalc.PurchasePrice = 50000;
            paymentcalc.InterestRate  = (decimal)6.0;
            paymentcalc.LoanTermYears = 5;

            var acutalCalculatePayment = paymentcalc.CalculatePayment();

            Assert.AreEqual(acutalCalculatePayment, compareamount);
        }
        private void btnGo_Click(object sender, EventArgs e)
        {
            IFileHandler fileHandler       = new FileHandler();
            ICalculator  paymentCalculator = new PaymentCalculator();

            CustomerProcessor customerProcessor = new CustomerProcessor(fileHandler, paymentCalculator);

            CustomerFacade cf = new CustomerFacade(customerProcessor);

            cf.Process(sourceFile, targetFolder);

            MessageBox.Show("Processing completed.", "Policy Renewals", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemplo n.º 18
0
        public void VerifyPositiveScenarious(LoanDetails input, PaymentDetails output)
        {
            //Arrange
            var calculator = new PaymentCalculator();

            //Act
            var result = calculator.Calculate(input);

            //Assert
            Assert.NotNull(result);
            Assert.Equal(output.MonthlyPayment, result.MonthlyPayment);
            Assert.Equal(output.TotalInterest, result.TotalInterest);
            Assert.Equal(output.TotalPayment, result.TotalPayment);
        }
Exemplo n.º 19
0
        public void TestPaymentCalculation()
        {
            GetPaymentAmountInput testInput = new GetPaymentAmountInput
            {
                AskingPrice        = 750000.00,
                DownPayment        = 158000.00,
                PaymentSchedule    = PaymentScheduleOptions.monthly,
                AmortizationPeriod = 240
            };

            var paymentCalculator = new PaymentCalculator(testInput, 0.025);
            var paymentAmount     = paymentCalculator.Calculate();

            Assert.Equal <double>(3137.0251267506815, paymentAmount);
        }
Exemplo n.º 20
0
        public void TestAnotherPaymentCalculation()
        {
            GetPaymentAmountInput testInput = new GetPaymentAmountInput
            {
                AskingPrice        = 360000.00,
                DownPayment        = 72000.00,
                PaymentSchedule    = PaymentScheduleOptions.monthly,
                AmortizationPeriod = 300
            };

            var paymentCalculator = new PaymentCalculator(testInput, 0.025);
            var paymentAmount     = paymentCalculator.Calculate();

            Assert.Equal <double>(1292.0161941406197, paymentAmount);
        }
Exemplo n.º 21
0
        static void Main(string[] args)
        {
            PaymentCalculator calculator = new PaymentCalculator();

            calculator.PurchasePrice = 50000;
            calculator.InterestRate  = 6.0;
            calculator.LoanTermYears = 5;
            for (int i = 0; i <= 10000; i += 1000)
            {
                calculator.DownPayment = i;
                DisplayLoanInformation(calculator);
            }

            Console.WriteLine("Press any to end");
            Console.ReadLine();
        }
Exemplo n.º 22
0
        public void CanGetTheTotalPaymentOfWorkedHoursInFourBoundaries()
        {
            DateTime testStart       = new DateTime(2018, 7, 6, 15, 0, 0);
            DateTime testEnd         = new DateTime(2018, 7, 6, 20, 0, 0);
            int      testCostPerHour = 10;

            var paymentBoundary = new PaymentBoundary(testStart, testEnd, testCostPerHour);

            DateTime testStart2       = new DateTime(2018, 7, 6, 20, 0, 0);
            DateTime testEnd2         = new DateTime(2018, 7, 7, 0, 0, 0);
            int      testCostPerHour2 = 10;

            var paymentBoundary2 = new PaymentBoundary(testStart2, testEnd2, testCostPerHour2);

            DateTime testStart3       = new DateTime(2018, 7, 7, 0, 0, 0);
            DateTime testEnd3         = new DateTime(2018, 7, 7, 2, 0, 0);
            int      testCostPerHour3 = 10;

            var paymentBoundary3 = new PaymentBoundary(testStart3, testEnd3, testCostPerHour3);

            DateTime testStart4       = new DateTime(2018, 7, 7, 2, 0, 0);
            DateTime testEnd4         = new DateTime(2018, 7, 7, 4, 0, 0);
            int      testCostPerHour4 = 10;

            var paymentBoundary4 = new PaymentBoundary(testStart4, testEnd4, testCostPerHour4);

            boundaries = new List <PaymentBoundary>
            {
                { paymentBoundary },
                { paymentBoundary2 },
                { paymentBoundary3 },
                { paymentBoundary4 }
            };

            sut = new PaymentCalculator(boundaries);

            var startTime = new DateTime(2018, 7, 6, 15, 0, 0);
            var endTime   = new DateTime(2018, 7, 7, 4, 0, 0);

            var expectedPayment = 130;

            var payment = sut.GetPayment(startTime, endTime);

            Assert.AreEqual(expectedPayment, payment);
        }
Exemplo n.º 23
0
        public DBRider(Person person, Annuities annuity)
        {
            annuity.DB = true;
            int growthYears = Math.Max(accumulation, person.retirementDate - DateTime.Now.Year);

            if (annuity.annuityTime == AnnuityTime.Immediate)
            {
                growthYears = 0;
            }

            annuity.rate -= (annuity.extraFees + fee);
            annuity.distributionsBeforeTax = PaymentCalculator.GetPayments(annuity.lumpSumAtRetirement, annuity.rate, annuity.yearsOfPayments);
            annuity.totalExpectedReturn    = annuity.distributionsBeforeTax * annuity.yearsOfPayments;
            annuity.exclusionRatio         = 0;

            if (annuity.annuityTax == AnnuityTax.Qualified)
            {
                annuity.exclusionRatio = annuity.initialAmount / annuity.totalExpectedReturn;
            }
        }
Exemplo n.º 24
0
        //calculates how much money a variable annuity will payout for a given year
        private List <double> VariableCalc(double carloRate)
        {
            List <double> currentYear   = new List <double>();
            double        currentAmount = initialAmount;

            lumpSumAtRetirement = FutureValue.GetFutureValue(initialAmount, carloRate, yearsToRetirement);
            currentYear.Add(initialAmount);
            if (annuityTime == AnnuityTime.Deferred)
            {
                for (int j = 0; j < yearsToRetirement; j++)
                {
                    currentAmount += lumpSumAtRetirement / yearsToRetirement;
                    currentYear.Add(currentAmount);
                }
            }
            distributionsBeforeTax = PaymentCalculator.GetPayments(currentAmount, carloRate, yearsOfPayments);
            if (glwb)
            {
                yearsOfPayments += 100;
            }
            for (int j = 0; j < yearsOfPayments; j++)
            {
                currentAmount += currentAmount * carloRate;
                if (gmwb || glwb)
                {
                    currentAmount -= distributionsBeforeTax;
                    currentAmount  = Math.Max((currentAmount - distributionsBeforeTax), (rider.annualIncome));
                }
                else
                {
                    currentAmount -= distributionsBeforeTax;
                    currentAmount  = Math.Max(0, currentAmount);
                }
                currentYear.Add(currentAmount);
            }
            return(currentYear);
        }
Exemplo n.º 25
0
 public IncomeReportGenerator(List <IDeductionRule> deductionRules)
 {
     _deductionRules = deductionRules;
     _calc           = new PaymentCalculator();
 }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            _mortgagesDAL = new MortgagesDAL();

            var mortgage = new Mortgage();
            var address  = new Address();

            Console.WriteLine("Calculate your new mortgage!");
            Console.WriteLine();

            Console.WriteLine("Please create or enter your User Name?");
            mortgage.UserName = Console.ReadLine();
            Console.WriteLine();

            Console.WriteLine("What is your purchase price?");
            mortgage.PurchasePrice = double.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What is your down payment?");
            mortgage.DownPayment = double.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What is the interest rate?");
            mortgage.InterestRate = double.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("How long will your loan be? 15 years or 30 years?");
            mortgage.TermLength = double.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What are your yearly taxes?");
            mortgage.Taxes = double.Parse(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("How much is your Homeowner's Insurance per year?");
            mortgage.Insurance = double.Parse(Console.ReadLine());
            Console.WriteLine();

            //calculate payment with taxes and insurance
            PaymentCalculator calculatePayment = new PaymentCalculator();

            double printPayment = calculatePayment.CalculatePayment(mortgage.PurchasePrice, mortgage.DownPayment, mortgage.InterestRate, mortgage.TermLength, mortgage.Taxes, mortgage.Insurance);

            // Displays Mortgage Payment
            Console.WriteLine($"Your new mortgage, including taxes and insurance is ${printPayment}. ");

            Console.WriteLine("Would you like to SAVE this mortgage to an address, Y or N?");
            string input = Console.ReadLine();

            if (input == "N")
            {
                Console.WriteLine("Would you like to try another query, Y or N?");
                string input2 = Console.ReadLine();
                if (input2 == "N")
                {
                    Console.WriteLine("Thank you and goodbye!");
                }
                else
                {
                    Console.WriteLine("Press ENTER to start over");
                }
            }
            else
            {
                _mortgagesDAL.SubmitMortgage(mortgage);
                Console.WriteLine("What is the property street address?");
                address.Street = Console.ReadLine();
                Console.WriteLine();
                Console.WriteLine("What city is the property located in?");
                address.City = Console.ReadLine();
                _mortgagesDAL.SubmitAddress(address);
            }
        }
Exemplo n.º 27
0
 public PaymentController(IHitCountService HitCountService, PaymentCalculator PaymentCalculator, IOptions <CloudFoundryApplicationOptions> ApplicationOptions)
 {
     _HitCountService    = HitCountService;
     _PaymentCalculator  = PaymentCalculator;
     _ApplicationOptions = ApplicationOptions.Value;
 }
Exemplo n.º 28
0
        static void Main(string[] args)
        {
            var  _paymentCalculator = new PaymentCalculator();
            bool end       = false;
            var  _payments = new List <Payment>();

            while (end)
            {
                Console.WriteLine("Credit Company");
                Console.WriteLine("Write your clientid:");
                string clientid = Console.ReadLine();

                //Klientas turi prisijungti irases savo ID, turetu buti ir slaptazodis
                // yra du klientai 123 ir 124
                switch (clientid)
                {
                case "123":
                    _payments = _paymentCalculator.paymentsOfJonas;
                    break;

                case "124":
                    _payments = _paymentCalculator.paymentsOfPetras;
                    break;

                default:
                    break;
                }
                Console.WriteLine("Choose what you want to do");
                Console.WriteLine("1 - Get current month payments");
                Console.WriteLine("2 - Get last month payments");
                Console.WriteLine("3 - Compare current month payments with last month");
                Console.WriteLine("4 - Show categories where I spend more than the last month");
                Console.WriteLine("5 - Show my payment by categories");
                Console.WriteLine("6 - EXIT");
                string option = Console.ReadLine();
                switch (option)
                {
                case "1":
                    _paymentCalculator.CountPaymentsOfCurrentMonth(_payments);
                    break;

                case "2":
                    _paymentCalculator.CountPaymentsOfLastMonth(_payments);
                    break;

                case "3":
                    // palygina dvieju menesiu islaidas
                    break;

                case "4":
                    // rodo kur daugiau isleista pinigu
                    break;

                case "5":
                    // rodo islaidas pagal kategorijas
                    break;

                case "6":
                    end = true;
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 29
0
 public PaymentController(IHitCountService HitCountService, PaymentCalculator PaymentCalculator)
 {
     _HitCountService   = HitCountService;
     _PaymentCalculator = PaymentCalculator;
 }