Пример #1
0
        public void Debt()
        {
            //Text introducing the program

            Console.WriteLine("\nDEBT CALCULATOR");
            Console.WriteLine("===============");

            //1st instruction
            Console.WriteLine("\nHow much do you owe? Only whole numbers, please.\n");

            //Taking a string input and converts it to int stored in 'save'

            int owe = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\nThank you. What is the rate on the loan in percent?\n");

            double owe_rate = Convert.ToDouble(Console.ReadLine());

            owe_rate = owe_rate * 0.01;

            Console.WriteLine("\nNow enter in how many terms you are going to pay your debt back:\n");

            int owe_terms = Convert.ToInt32(Console.ReadLine());

            double debtPMT = owe * (owe_rate / (1 - Math.Pow((1 + owe_rate), owe_terms * -1)));

            Console.WriteLine("\nThe amount you should pay every term:\n");

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(debtPMT);

            Console.ForegroundColor = ConsoleColor.Black;

            //Lastly, we give the user the option of trying again and going back
            Console.WriteLine("\nWould you like to (1) try again or (2) go back?");

            string key = Console.ReadLine();

            if (key == "1")
            {
                Debt();
            }
            if (key == "2")
            {
                Console.Clear();
                savingsMenu class2 = new savingsMenu();
                class2.MenuSavings();
            }
        }
Пример #2
0
        public void Debt()
        {
            //Text introducing the program

            Console.WriteLine ("\nDEBT CALCULATOR");
            Console.WriteLine ("===============");

            //1st instruction
            Console.WriteLine ("\nHow much do you owe? Only whole numbers, please.\n");

            //Taking a string input and converts it to int stored in 'save'

            int owe = Convert.ToInt32 (Console.ReadLine ());

            Console.WriteLine ("\nThank you. What is the rate on the loan in percent?\n");

            double owe_rate = Convert.ToDouble (Console.ReadLine ());

            owe_rate = owe_rate * 0.01;

            Console.WriteLine ("\nNow enter in how many terms you are going to pay your debt back:\n");

            int owe_terms = Convert.ToInt32 (Console.ReadLine ());

            double debtPMT = owe * (owe_rate / (1 - Math.Pow ((1 + owe_rate), owe_terms * -1)));

            Console.WriteLine ("\nThe amount you should pay every term:\n");

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine (debtPMT);

            Console.ForegroundColor = ConsoleColor.Black;

            //Lastly, we give the user the option of trying again and going back
            Console.WriteLine ("\nWould you like to (1) try again or (2) go back?");

            string key = Console.ReadLine ();

            if (key == "1") {
                Debt ();
            }
            if (key == "2") {
                Console.Clear ();
                savingsMenu class2 = new savingsMenu ();
                class2.MenuSavings ();
            }
        }
Пример #3
0
            private static double var1;            //Used for input 1

            //Main method
            public static void Main(string[] args)
            {
                //Menu for selectin calculator of choice
                Console.WriteLine("Choose your desired calculator:");
                Console.WriteLine("Press 1 for Inverse Polish Notation Calculator");
                Console.WriteLine("Press 2 for Savings Calculator");
                Console.WriteLine("Press 3 for Dept Calculator");
                Console.WriteLine("Press 4 for Measurement Converter");
                Console.WriteLine("Press 5 for BMI calculator");
                menuVar = Convert.ToString(Console.ReadLine());

                switch (menuVar)
                {
                case "1":                               //Invers Polish Notation
                    Console.WriteLine("Input 1 here:"); //First input
                    Console.WriteLine("Enter a number: ");
                    var1 = Convert.ToDouble(Console.ReadLine());
                    InversPolishNotation IPN = new InversPolishNotation();
                    IPN.Calcs(var1);
                    break;

                case "2":                 //Savings
                    savingsMenu save = new savingsMenu();
                    save.MenuSavings();
                    break;

                case "3":                 //Dept
                    dept deptInstance = new dept();
                    deptInstance.Debt();
                    break;

                case "4":                 //Converter
                    converter Con = new converter();
                    Con.converterMenu();
                    break;

                case "5":                 //BMI
                    BMI bmi = new BMI();
                    bmi.BmiCalc();
                    break;
                }
            }
Пример #4
0
            private static double var1; //Used for input 1

            #endregion Fields

            #region Methods

            //Main method
            public static void Main(string[] args)
            {
                //Menu for selectin calculator of choice
                Console.WriteLine ("Choose your desired calculator:");
                Console.WriteLine ("Press 1 for Inverse Polish Notation Calculator");
                Console.WriteLine ("Press 2 for Savings Calculator");
                Console.WriteLine ("Press 3 for Dept Calculator");
                Console.WriteLine ("Press 4 for Measurement Converter");
                Console.WriteLine ("Press 5 for BMI calculator");
                menuVar = Convert.ToString (Console.ReadLine ());

                switch (menuVar) {
                case "1": //Invers Polish Notation
                    Console.WriteLine ("Input 1 here:");//First input
                    Console.WriteLine ("Enter a number: ");
                    var1 = Convert.ToDouble (Console.ReadLine ());
                    InversPolishNotation IPN = new InversPolishNotation ();
                    IPN.Calcs (var1);
                    break;
                case "2": //Savings
                    savingsMenu save = new savingsMenu ();
                    save.MenuSavings ();
                    break;
                case "3": //Dept
                    dept deptInstance = new dept ();
                    deptInstance.Debt ();
                    break;
                case "4": //Converter
                    converter Con = new converter ();
                    Con.converterMenu ();
                    break;
                case "5": //BMI
                    BMI bmi = new BMI ();
                    bmi.BmiCalc ();
                    break;
                }
            }
Пример #5
0
        public void SavingsMultiple()
        {
            //Text introducing the program
            Console.WriteLine("\nSAVINGS CALCULATOR");
            Console.WriteLine("==================");

            //1st instruction
            Console.WriteLine("\nWrite the payment you want to continiously deposit: ");

            //Taking a string input and converts it to int stored in 'save'
            int save_m = Convert.ToInt32(Console.ReadLine());

            //2nd instruction
            Console.WriteLine("\nThank you. Now insert rate in percent (use '.' for dot): ");

            //Again taking an input, converts it to a double as this variable needs to become a decimal number
            double saveRate_m = Convert.ToDouble(Console.ReadLine());

            //Turns the rate, stored by the user, into a number to be used in the savings-formula
            saveRate_m = saveRate_m * 0.01;

            //3rd instruction, 3rd storing
            Console.WriteLine("\nThank you. Now insert number of terms: ");
            int termNo_m = Convert.ToInt32(Console.ReadLine());

            Console.Clear();

            //Presents the user what has been stored
            Console.WriteLine("Present Value: " + save_m + "\nRate: " + saveRate_m * 100.0 + "%" + "\nNo of terms: " + termNo_m);

            //The actual calculation, being stored into the variable PMT. The formula is: An = b * ((1 + r)^n - 1 / r)
            double PMT_m = save_m * ((Math.Pow((1 + saveRate_m), termNo_m) - 1) / saveRate_m);

            //Rounds up the PMT-number to only hold two decimals
            PMT_m = Math.Round(PMT_m, 2);

            //Calculates the total money deposited by multiplying the save with the no of terms
            int totalPay_m = save_m * termNo_m;

            Console.WriteLine("Money deposited in total: " + totalPay_m);

            //This line prints the result to the terminal
            Console.WriteLine("\nFuture Value (PMT): \n");

            Console.ForegroundColor = ConsoleColor.Green;

            Console.WriteLine(PMT_m);

            Console.ForegroundColor = ConsoleColor.Black;

            //Lastly, we give the user the option of trying again and going back through an if-statement
            Console.WriteLine("\nWould you like to...\n\n1) Try again \n2) Go back\n");

            string key = Console.ReadLine();

            if (key == "1")
            {
                SavingsMultiple();
            }
            if (key == "2")
            {
                savingsMenu savingsMenuClass = new savingsMenu();
                savingsMenuClass.MenuSavings();
                Console.WriteLine();
            }
        }
Пример #6
0
        public void Saver()
        {
            //Text introducing the program
            Console.WriteLine("\nSAVINGS CALCULATOR");
            Console.WriteLine("==================");

            //1st instruction
            Console.WriteLine("\nEnter the amount you would like to deposit: ");

            //Taking a string input and converts it to int stored in 'save'
            int save = Convert.ToInt32(Console.ReadLine());

            /*if (save < 0) {
             *      Console.WriteLine ("Number cant be negative, please try again");
             * }*/

            //2nd instruction
            Console.WriteLine("\nThank you. Now insert rate in percent (use '.' for dot): ");

            //Again taking an input, converts it to a double as this variable needs to become a decimal number
            double saveRate = Convert.ToDouble(Console.ReadLine());

            //Turns the rate, stored by the user, into a number to be used in the savings-formula
            saveRate = saveRate * 0.01;

            //3rd instruction, 3rd storing
            Console.WriteLine("\nThank you. Now insert number of terms: ");
            int termNo = Convert.ToInt32(Console.ReadLine());

            Console.Clear();

            //Presents the user what has been stored
            Console.WriteLine("Present Value: " + save + "\nRate: " + saveRate * 100.0 + "%" + "\nNo of terms: " + termNo);

            //The actual calculation, being stored into the variable PMT. The formula is: Kn = Ko * (1 + r)^n
            double PMT = save * Math.Pow((1 + saveRate), termNo);

            //Rounds up the PMT-variable to only hold two decimals
            PMT = Math.Round(PMT, 2);

            //Makes the text stand out by coloring it green
            Console.ForegroundColor = ConsoleColor.Green;

            //This line prints the result to the terminal
            Console.WriteLine("\nFuture Value (PMT): " + PMT);

            //Turns the text back to black
            Console.ForegroundColor = ConsoleColor.Black;

            //Lastly, we give the user the option of trying again or going back

            Console.WriteLine("\nWould you like to...\n\n1) Try again \n2) Go back\n");

            string key = Console.ReadLine();

            if (key == "1")
            {
                Saver();
            }

            if (key == "2")
            {
                //Whipes the terminal
                Console.Clear();
                savingsMenu class2 = new savingsMenu();
                class2.MenuSavings();
            }
        }
Пример #7
0
        public void Saver()
        {
            //Text introducing the program
            Console.WriteLine ("\nSAVINGS CALCULATOR");
            Console.WriteLine ("==================");

            //1st instruction
            Console.WriteLine ("\nEnter the amount you would like to deposit: ");

            //Taking a string input and converts it to int stored in 'save'
            int save = Convert.ToInt32 (Console.ReadLine ());

            /*if (save < 0) {
                Console.WriteLine ("Number cant be negative, please try again");
            }*/

            //2nd instruction
            Console.WriteLine ("\nThank you. Now insert rate in percent (use '.' for dot): ");

            //Again taking an input, converts it to a double as this variable needs to become a decimal number
            double saveRate = Convert.ToDouble (Console.ReadLine ());

            //Turns the rate, stored by the user, into a number to be used in the savings-formula
            saveRate = saveRate * 0.01;

            //3rd instruction, 3rd storing
            Console.WriteLine ("\nThank you. Now insert number of terms: ");
            int termNo = Convert.ToInt32 (Console.ReadLine ());

            Console.Clear ();

            //Presents the user what has been stored
            Console.WriteLine ("Present Value: " + save + "\nRate: " + saveRate * 100.0 + "%" + "\nNo of terms: " + termNo);

            //The actual calculation, being stored into the variable PMT. The formula is: Kn = Ko * (1 + r)^n
            double PMT = save * Math.Pow ((1 + saveRate), termNo);

            //Rounds up the PMT-variable to only hold two decimals
            PMT = Math.Round (PMT, 2);

            //Makes the text stand out by coloring it green
            Console.ForegroundColor = ConsoleColor.Green;

            //This line prints the result to the terminal
            Console.WriteLine ("\nFuture Value (PMT): " + PMT);

            //Turns the text back to black
            Console.ForegroundColor = ConsoleColor.Black;

            //Lastly, we give the user the option of trying again or going back

            Console.WriteLine ("\nWould you like to...\n\n1) Try again \n2) Go back\n");

            string key = Console.ReadLine ();

            if (key == "1") {
                Saver ();
            }

            if (key == "2") {
                //Whipes the terminal
                Console.Clear ();
                savingsMenu class2 = new savingsMenu ();
                class2.MenuSavings ();
            }
        }
Пример #8
0
        public void SavingsMultiple()
        {
            //Text introducing the program
            Console.WriteLine ("\nSAVINGS CALCULATOR");
            Console.WriteLine ("==================");

            //1st instruction
            Console.WriteLine ("\nWrite the payment you want to continiously deposit: ");

            //Taking a string input and converts it to int stored in 'save'
            int save_m = Convert.ToInt32 (Console.ReadLine ());

            //2nd instruction
            Console.WriteLine ("\nThank you. Now insert rate in percent (use '.' for dot): ");

            //Again taking an input, converts it to a double as this variable needs to become a decimal number
            double saveRate_m = Convert.ToDouble (Console.ReadLine ());

            //Turns the rate, stored by the user, into a number to be used in the savings-formula
            saveRate_m = saveRate_m * 0.01;

            //3rd instruction, 3rd storing
            Console.WriteLine ("\nThank you. Now insert number of terms: ");
            int termNo_m = Convert.ToInt32 (Console.ReadLine ());

            Console.Clear ();

            //Presents the user what has been stored
            Console.WriteLine ("Present Value: " + save_m + "\nRate: " + saveRate_m * 100.0 + "%" + "\nNo of terms: " + termNo_m);

            //The actual calculation, being stored into the variable PMT. The formula is: An = b * ((1 + r)^n - 1 / r)
            double PMT_m = save_m * ((Math.Pow ((1 + saveRate_m), termNo_m) - 1) / saveRate_m);

            //Rounds up the PMT-number to only hold two decimals
            PMT_m = Math.Round (PMT_m, 2);

            //Calculates the total money deposited by multiplying the save with the no of terms
            int totalPay_m = save_m * termNo_m;

            Console.WriteLine ("Money deposited in total: " + totalPay_m);

            //This line prints the result to the terminal
            Console.WriteLine ("\nFuture Value (PMT): \n");

            Console.ForegroundColor = ConsoleColor.Green;

            Console.WriteLine (PMT_m);

            Console.ForegroundColor = ConsoleColor.Black;

            //Lastly, we give the user the option of trying again and going back through an if-statement
            Console.WriteLine ("\nWould you like to...\n\n1) Try again \n2) Go back\n");

            string key = Console.ReadLine ();

            if (key == "1") {
                SavingsMultiple ();
            }
            if (key == "2") {
                savingsMenu savingsMenuClass = new savingsMenu ();
                savingsMenuClass.MenuSavings ();
                Console.WriteLine ();
            }
        }