import java.util.*;
class distance
{
public static void main(String args[])
{
int ch=0;
float u,t,a,dist=0;
Scanner sc;
sc=new Scanner(System.in);
do
{
System.out.println("1.Enter t,a,u \n 2.Exit");
System.out.println("Enter ur choice:");
ch=sc.nextInt();
switch(ch)
{
case 1:
System.out.println("Enter time , initial speed & acceleration:");
t=sc.nextFloat();
u=sc.nextFloat();
a=sc.nextFloat();
dist=(u*t)+((a*t*t)/2);
System.out.println("The distance is:"+dist);
case 2:
break;
}
}while(ch!=2);
}
}
No comments:
Post a Comment