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

C # Programming help. Using Visual Studio Falling Distance (2) When an object is

ID: 3565596 • Letter: C

Question

C # Programming help. Using Visual Studio

Falling Distance (2)

When an object is falling because of gravity, the following formula can be used to determine the distance the object falls in a specific time period:

d = 1/2gt2

The variables in the formula are as follows: d is the distance in meters, g is 9.8, and t is the amount of time in seconds that the object has been falling. Create an application that allows the user to enter the amount of time that an object has fallen and then displays the distance that the object fell. The application should have a function named FallingDistance. The FallingDistance function should accept an object

Explanation / Answer

using System;

namespace Example1
{
class calculation
   {
   
     double result;
   
     public double FallingDistance(int sec)
      {
      

        result=(double)(((9.8)*(sec*sec))/2);

      

        Console.Write(" d = {0}", result);
        Console.ReadLine();
        return result ;
      }
   }
class Program
   {
     static void Main(string[] args)
      {
          Console.Write("Enter no. of secs ");
       int num1 = Convert.ToInt32(Console.ReadLine());
       new calculation().FallingDistance(num1);
      }
   }
}

o/p: