Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Although the following code compiles and runs, the programmer broke some major r

ID: 3551184 • Letter: A

Question

Although the following code compiles and runs, the programmer broke some major readability rules. Describe at least three changes that would make it easier for other programmers to read and understand the code.

class Program { static void Main() //TBD
{
   double count;
   double Double = 10; // declare variables
   for(int i = 0;i < Double;i++) //keep doing
        {
            count=function(i);
            Console.WriteLine(count);
        }
        Console.Read();
        }
        public static double function(int a) //a function
        {
        return (Math.Sqrt(a));
        }
   }

Explanation / Answer

1). Make it coloured for example use different colour for user function than calling built in function.

2). Use tab space when using "for loop"

3).Use new line to start "Main()" function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote