December 5, 2016

Same variables for different methods?

Hey guys, I need some guidance on how to put values in and put them in different methods putting them in the same values. I’ll put in the source code for the exercise question and I’d appreciate some guidance on this.

double salesOut;
            double retTotal;
            salesOut = sales();
        }//End Main
        static void employee()
            Console.Write("What is employees name: ");

            string empName = Console.ReadLine();

            Console.WriteLine("Employees name inputted: {0}", empName);

        static double sales()
            Console.WriteLine("What are the sales of the employee: ");

            string sales = Console.ReadLine();

            double salesOut = int.Parse(sales);
            Console.WriteLine(" Employee sales inputted: {0}", sales);

            return salesOut;

        static double commission(double salesOut)
            double comm = 0.07;

            double commTotal = comm * salesOut;
            Console.WriteLine("Commission: {0:C}", commTotal);
            return commTotal;
        static double securityTax(double salesOut)
            double secTax = 0.09;

            double secTotal = secTax * salesOut;
            Console.WriteLine("Security: {0:C}", secTotal);
            return secTotal;

        static double federalTax(double salesOut)
            double fedTax = 0.18;

            double fedTotal = fedTax * salesOut;
            Console.WriteLine("Federal: {0:C}", fedTotal);
            return fedTotal;

        static double retirementCon(double salesOut)
            double retCon = 0.15;
            double retTotal = retCon * salesOut;
            Console.WriteLine("Retirement Contribution: {0:C}", retCon);
            return retTotal;

        static void finalValue(double salesOut)

            double final = retTotal + fedTotal + secTotal;
            Console.WriteLine("Final Values: {0:C} ", final );


I know it might look basic but I’m having an issue with the FINAL VALUE method and putting all totals from the other methods and inserting it in there.

Category : Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by Bolkya Resha and Software Testing Theme