static void Main() { double grossIncome = 0; double monthlyTax = 0; string option = ""; HomeLoan home = new HomeLoan(grossIncome, monthlyTax, option); Console.WriteLine("Enter your Gross monthly income(before deductions): "); grossIncome = Convert.ToDouble(Console.ReadLine()); home.InputExpenditures(); Console.WriteLine("Enter your estimated monthly tax deducted: "); monthlyTax = Convert.ToDouble(Console.ReadLine()); home.CheckMonthlyTax(monthlyTax, grossIncome); Console.WriteLine("Enter A or B for your accomadation type:" + "\n" + "A) Rent" + "\n" + "B) Purchase Property"); option = Console.ReadLine(); home.Selection(option); Console.WriteLine(); Console.WriteLine("***************************************************"); home.GrossIncome = grossIncome; Console.WriteLine("Gross Income: " + home.GrossIncome); Console.WriteLine("Monthly Tax: " + monthlyTax); Console.WriteLine("Total Monthly Expenditure(no tax included): " + home.GetExpenditureTotal()); Console.WriteLine("Available Monthly Money(after tax and monthly expenditure is deducted): " + (home.GrossIncome - home.GetExpenditureTotal() - monthlyTax)); Console.WriteLine("Total Loan Repayment: " + home.CalculateLoan()); Console.WriteLine("Monthly loan repayment: " + home.GetMonthlyLoanRepayment()); home.Alert(); }
static void Main() { //declaring variables to take in income and tax double grossIncome = 0; double monthlyTax = 0; //calling method to print the banner PrintBanner(); Console.WriteLine("Enter your Gross monthly income(before deductions): "); grossIncome = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter your estimated monthly tax deducted: "); monthlyTax = Convert.ToDouble(Console.ReadLine()); while (monthlyTax >= grossIncome) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error monthly tax cannot be equal or more than gross income"); Console.ResetColor(); Console.WriteLine("Enter your estimated monthly tax deducted: "); monthlyTax = Convert.ToDouble(Console.ReadLine()); } //creating an instance of the homeloan class HomeLoan home = new HomeLoan(grossIncome, monthlyTax); home.InputExpenditures(); home.CheckExpenses(); Console.WriteLine("Enter A or B for your accomadation type:" + "\n" + "A) Rent" + "\n" + "B) Purchase Property"); home.Option = Console.ReadLine(); home.Selection(home.Option); //printing out final report Console.WriteLine(); Console.WriteLine("***************************************************"); Console.WriteLine("Gross Income: " + home.GrossIncome); Console.WriteLine("Monthly Tax: " + home.Tax); Console.WriteLine("Total Monthly Expenditure(no accomodation included): " + home.GetExpenditureTotal()); Console.WriteLine("Available Monthly Money(after tax and monthly expenditure(accomodation not included) is deducted): " + (home.GrossIncome - home.GetExpenditureTotal() - home.Tax)); Console.WriteLine("Total Loan Repayment: " + home.CalculateLoan()); Console.WriteLine("Monthly Loan Repayment: " + home.GetMonthlyLoanRepayment()); home.SetExpenditureTotal(home.Option); Console.WriteLine("Total Monthly Expenditure(after the accomodation included): " + home.GetExpenditureTotal()); Console.WriteLine("Available Monthly money after expenditures(including monthly loan repayment) and tax are deducted: " + (home.GrossIncome - home.GetExpenditureTotal() - home.Tax)); home.Alert(); }