Hello Guys! Welcome To My Blog!
Loan Calculator In C#
Today we will be learn about How to make Loan Calculator!
In this Code we Use the Method
Making a Method makes it Easy to understand the Program and it is a sign of a Good Programmer!
Actually This Program is Big but it's user interface is very good!in this Code we use IF ELSE Condition!
Hope you Guys Like it!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace loan
{
class Program
{
public void loancalculator()//this is method
{
int intrest1 = 3; //this varaible belongs to intrest Values...
int intrest2 = 5;
int intrest3 = 8;
int intrest4 = 10;
int intrest5 = 12;
int percentage;
string per = "";//this varaibles belongs to user information
string name = "";
string live = "";
string purpose = "";
string bank = "";
string source = "";
string income = "";
string month = "";
Console.WriteLine("\t\t\t\tPERSONAL LOAN CALCULATOR IN PAKISTAN ");
Console.WriteLine("\t\t\t\t\t_____MAWAZNA.COM_____\n");
Console.WriteLine("Enter Your Name:");
name = Console.ReadLine();
Console.WriteLine("Where Do You Live Currently?");
string userInput = "";
while (true)
{
Console.WriteLine("\n1:Lahore\t\t2:Karachi\t\t3:Islamabad\n4:Rawalpindi\t\t5:Faisalabad\t\t6:Multan\n7:Hyderabad\t\t8:Pesahwar\t\t9:other\n");//Cities Name of Pakistan
userInput = Console.ReadLine();
if (userInput == "1")
{
live = "Lahore"; //if user select any option the condition will be break
break;
}
else if (userInput == "2")
{
live = "Karachi";
break;
}
else if (userInput == "3")
{
live = "Islamabad";
break;
}
else if (userInput == "4")
{
live = "Rawalpindi";
break;
}
else if (userInput == "5")
{
live = "Faisalabad";
break;
}
else if (userInput == "6")
{
live = "Mltan";
break;
}
else if (userInput == "7")
{
live = "Hyderabad";
break;
}
else if (userInput == "8")
{
live = "Pesahwar";
break;
}
else if (userInput == "9")
{
Console.WriteLine("Where Do You Live?");
live = Console.ReadLine();//user also put any city with his own wish
break;
}
else { Console.WriteLine("Sorry Wrong Input, Choose between 1-9\n\n"); }
}//if user select wrong option the program will be go back to the same question again
Console.WriteLine("What Is The Main Purpose Of Your Loan?");
while (true)
{
Console.WriteLine("\n1:Home Improvement\t\t2:Children Education Fees\t\t3:Wedding Expenses\n4:Debt Consolidation\t\t5:Buying Household Items\t\t6:Going On Vacation\n7:Buying Another Car\t\t8:Purchasing Property\t\t\t9:Business");
userInput = Console.ReadLine();//select your pupose...
if (userInput == "1")
{
purpose = "Home Improvement";
break;
}
else if (userInput == "2")
{
purpose = "Children Education fees";
break;
}
else if (userInput == "3")
{
purpose = "Wedding Expenses";
break;
}
else if (userInput == "4")
{
purpose = "Debt Consolidation";
break;
}
else if (userInput == "5")
{
purpose = "Buying Household Items";
break;
}
else if (userInput == "6")
{
purpose = "Going On Vacation";
break;
}
else if (userInput == "7")
{
purpose = "Buying Another Car";
break;
}
else if (userInput == "8")
{
purpose = "Purchasing Property";
break;
}
else if (userInput == "9")
{
purpose = "Business";
break;
}
else { Console.WriteLine("Sorry Wrong Input, Choose between 1-9\n\n"); }
}
Console.WriteLine("How Much do you want to borrow?\n" + "Loan:");
int loan = int.Parse(Console.ReadLine());//how much do you want loan
Console.WriteLine("Loan Period");
while (true)
{
Console.WriteLine("\n1:12 Months\t\t2:24 Months\t\t3:36 Months\t\t4:48 Months\t\t5:60 Months\t");
userInput = Console.ReadLine();
if (userInput == "1")
{
month = "12 Months";
percentage = loan / 100 * intrest1;
per = "3%";//as your year increases ,such intrest will increase
break;
}
else if (userInput == "2")
{
month = "24 Months";
percentage = loan / 100 * intrest2;
per = "5%";//as your year increases ,such intrest will increase
break;
}
else if (userInput == "3")
{
month = "36 Months";
percentage = loan / 100 * intrest3;
per = "8%";//as your year increases ,such intrest will increase
break;
}
else if (userInput == "4")
{
month = "48 Months";
percentage = loan / 100 * intrest4;
per = "10%";//as your year increases ,such intrest will increase
break;
}
else if (userInput == "5")
{
month = "60 Months";
percentage = loan / 100 * intrest5;
per = "12%";//as your year increases ,such intrest will increase
break;
}
else
{
Console.WriteLine("Sorry Wrong Input, Choose between 1-5\n\n");
}
}
Console.WriteLine("\nWhat Is Your Source Of Income?\n");
while (true)
{
Console.WriteLine("1:Salaried Person\t\t2:Self Employed Professional\t\t3:BusinessMan");
userInput = Console.ReadLine();//select source of income....
if (userInput == "1")
{
source = "Salaried Person";
break;
}
else if (userInput == "2")
{
source = "Self Employed Professional";
break;
}
else if (userInput == "3")
{
source = "Businessman";
break;
}
else
{
Console.WriteLine("Sorry Wrong Input, Choose between 1-3\n\n");
}
}
Console.WriteLine("What's your income?\n");
userInput = Console.ReadLine();//put your income
income = userInput;
Console.WriteLine("Which banks you have currently relationship with for any financial products including bank accounts, credit cards, loans or any other financial products ?\n ");
while (true)//select your current bank
{
Console.WriteLine("\n1:Habib Bank\t\t2:Habib Bank Metropolitan\t3:BankAlafalah");
Console.WriteLine("\n4:UBL\t\t\t5:MCB\t\t\t\t6:Askari Bank");
Console.WriteLine("\n7:Standard C Bank\t8:Meezan Bank\t\t\t9:NPB");
Console.WriteLine("\n10:JS Bank\t\t11:NIB Bank\t\t\t12:Bank Islami");
Console.WriteLine("\n13:Soneri Bank\t\t14:Summit Bank\t\t\t15:Burj Bank");
Console.WriteLine("\n16:Silk Bank\t\t17:Bank Of Punjab\t\t18:Allied Bank");
Console.WriteLine("\n\t\t19:Faysal Bank\t\t20:Bank AL Habib");
userInput = Console.ReadLine();
if (userInput == "1")
{
bank = "Habib Bank";
break;
}
else if (userInput == "2")
{
bank = "Habib Bank Metropolitan";
break;
}
else if (userInput == "3")
{
bank = "Bank Alafalah";
break;
}
else if (userInput == "4")
{
bank = "UBL";
break;
}
else if (userInput == "5")
{
bank = "MCB";
break;
}
else if (userInput == "6")
{
bank = "Askari Bank";
break;
}
else if (userInput == "7")
{
bank = "Standard Chartered Bank";
break;
}
else if (userInput == "8")
{
bank = "Meezan Bank";
break;
}
else if (userInput == "9")
{
bank = "NPB";
break;
}
else if (userInput == "10")
{
bank = "JS Bank";
break;
}
else if (userInput == "11")
{
bank = "NIB Bank";
break;
}
else if (userInput == "12")
{
bank = "Bank Islami";
break;
}
else if (userInput == "13")
{
bank = "Soneri Bank";
break;
}
else if (userInput == "14")
{
bank = "Summit Bank";
break;
}
else if (userInput == "15")
{
bank = "Burj Bank";
break;
}
else if (userInput == "16")
{
bank = "Silk Bank";
break;
}
else if (userInput == "17")
{
bank = "Bank of Punjab";
break;
}
else if (userInput == "18")
{
bank = "Allied Bank";
break;
}
else if (userInput == "19")
{
bank = "Faysal Bank";
break;
}
else if (userInput == "20")
{
bank = "Bank Al Habib";
break;
}
else { Console.WriteLine("Sorry Wrong Input, Choose between 1-20\n\n"); }
}
//Your Summarry of loan Requirement
Console.WriteLine("\n_____Summary of Your Loan Requirement_____\n");
Console.WriteLine("Your Name: " + name + "\nYour City: " + live + "\nPurpose Of Loan: " + purpose + "\nLoan Amount: " + loan + "\nLoan term: " + month + "\nSource Of Income: " + source + "\nMonthly Income: " + income + "\nCurrent Bank: " + bank + "\nAfter " + per + " Intrest: Your Amount Is " + (loan + percentage));
}
static void Main(string[] args)
{
Program obj = new Program();
obj.loancalculator();
Console.ReadLine();
}
}
}
very simple and amazing code thanku so much for sharing❤️
ReplyDelete