Answer to Question #256012 in C# for Umar farouk

Question #256012
Physics: acceleration) Average acceleration is defined as the change of velocity divided by the time taken to make the change, as shown in the following formula: Write a program that prompts the user to enter the starting velocity in meters/second, the ending velocity in meters/second, and the time span t in seconds, and displays the average acceleration
1
Expert's answer
2021-10-28T01:22:59-0400

using System;


namespace ConsoleApp1

{

  class Program

  {

    static void Main(string[] args)

    {

      try

      {

        Console.Write("Input starting velocity (m/s):");

        string str = Console.ReadLine();

        float fs = int.Parse(str);


        Console.Write("Input ending velocity (m/s):");

        str = Console.ReadLine();

        float es = int.Parse(str);


        Console.Write("Input time span (s):");

        str = Console.ReadLine();

        float ts = int.Parse(str);


        if (ts == 0)

        {

          Console.WriteLine("Bad number 'time span'.");

          return;

        }

        float res = (es - fs) / ts;

        Console.WriteLine("Average acceleration (m/s^2): {0:F3}", res);

      }

      catch

      {

        Console.WriteLine("Bad number");

        return;

      }

    }

  }

}



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