Solution:
Pseudo Code:
- Initialize variable "vi" (this will hold initial velocity value)
- Initialize variable "t" to (this will hold time value)
- Print message on console to ask user to input Initial velocity.
- Read user's input and convert to Double and store that input into variable "vi" that is necessary for velocity formula.
- Print message on console to ask user to input Time.
- Read user's input and convert to Double and store that input into variable "t" that is necessary for velocity formula.
- create a separate function "calculateFinalVelocity" that will calculate velocity on the basis of initial velocity and time values and will return the final velocity, then call "calculateFinalVelocity(vi,t)" function and pass "vi" and "t".
- Print the return value of on console to show the final velocity...
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication20
{
class myclass
{
public double calculateFinalVelocity(double vi,double t)
{
double vf =
vi+t*9.98;
return vf;
}
static void Main(string[] args)
{
double vi,t;
Console.WriteLine("plz
enter the initial velocity");
vi=Convert.ToDouble(Console.ReadLine());
Console.WriteLine("plz
enter the time ");
t= Convert.ToDouble(Console.ReadLine());
myclass m = new myclass();
Console.WriteLine("the
the final velocity is {0}",m.calculateFinalVelocity(vi,t));
}
}
}
No comments:
Post a Comment