Answer to Question #340061 in C# for Julie

Question #340061

Using C# and Visual Studio, design and implement a standalone command line application that fulfils the following requirements:


1. The user shall be able to enter the following values:


a. Gross monthly income (before deductions).


b. Estimated monthly tax deducted.


c. Estimated monthly expenditures in each of the following categories:


i. Groceries


ii. Water and lights


iii. Travel costs (including petrol)


iv. Cell phone and telephone


v. Other expenses


2. The user shall be able to choose between renting accommodation or buying a property.


3. If the user selects to rent, the user shall be able to enter the monthly rental amount.


4. If the user selects to buy a property, the user shall be required to enter the following values for a home loan:


a. Purchase price of property


b. Total deposit


c. Interest rate (percentage)


d. Number of months to repay (between 240 and 360)


5. The software shall calculate the monthly home loan repayment for buying a property based on the values that the user entered






1
Expert's answer
2022-05-14T16:42:19-0400
internal class Program
    {
        static void Main(string[] args)
        {
            EnterInformation();
            Housing();
            Console.ReadKey();
        }


        static void EnterInformation()
        {
            Console.Write("Enter gross monthly income (before deductions): ");
            Console.ReadLine();
            Console.Write("Enter estimated monthly tax deducted: ");
            Console.ReadLine();


            Console.WriteLine("Estimated monthly expenditures in each of the following categories: ");
            Console.Write("Groceries: ");
            Console.ReadLine();
            Console.Write("Water and lights: ");
            Console.ReadLine();
            Console.Write("Travel costs (including petrol):");
            Console.ReadLine();
            Console.Write("Cell phone and telephone: ");
            Console.ReadLine();
            Console.Write("Other expenses: ");
            Console.ReadLine();
        }


        static void Housing()
        {
            Console.WriteLine("Choose what you prefer\n1.Rental of property \n2.Buying a home");
            switch (Console.ReadLine())
            {
                case "1":
                    {
                        Console.WriteLine("Enter your monthly rent");
                        Console.ReadLine();
                        break;
                    }
                case "2":
                    {
                        Console.WriteLine("Enter purchase price of property");
                        double t = double.Parse(Console.ReadLine());
                        Console.WriteLine("Enter total deposit");
                        double p = double.Parse(Console.ReadLine());
                        Console.WriteLine("interest rate (percentage)");
                        double r = double.Parse(Console.ReadLine())/12 / 100;
                        Console.WriteLine("Enter number of months to repay (between 240 and 360)");
                        int n = int.Parse(Console.ReadLine());


                        double m = (t - p) * (r * Math.Pow(1 + r, n)) / (Math.Pow(1 + r, n) - 1);
                        Console.WriteLine($"Your monthly mortgage payment for the purchase of real estate based on values:" +
                            $" {Math.Round(m, 4)}");
                        break;
                    }
            }


        }


    }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS