AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: Speedy Kings

Speedy kings are a racing group. Their leader John owns a Suzuki Hayabusa which has a maximum speed of 300 kmph. The leader of the rival group, Ranson owns a Ducati whose maximum speed is 280 kmph. John makes n rounds of 10km track. How much time(in minutes) will Ranson take to complete the same distance covered by John. Take the value of n as input from the user. Sample Input: 4 Sample Output: 8

corejava x 336
programming x 153
Posted On : 2016-11-04 22:09:00.0
profile Aarti Kumar - anyforum.in Aarti Kumar
5900
up-rate
3
down-rate

Answers


import java.util.*;
class TrackSpeed{
public static void main(String[] args){
Scanner s=new Scanner(System.in);
int N=s.nextInt();
if(N>0){
double speed=280; //Ranson Ducati maximum speed
double track=10.0; //Here t is track distance
double Time=(N*track)/speed*60; //time =d/speed ; here speed converts into minutes like (speed*60)
System.out.println((int)(Time));
//System.out.println((int)(Time)+" "+"Minutes");
}
else
{
System.out.println("You have entered No.Of rounds per track distance was Empty...");
}
}
}

Posted On : 2016-11-10 19:51:55
Satisfied : 1 Yes  0 No
profile sudheerkumar Javvadi - anyforum.in sudheerkumar Javvadi
0970
Reply This Thread
up-rate
4
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in