Computer Science, asked by UtkarshChawhan, 4 months ago

The driver took a drive to a town 240 km at a speed of 60 km/hr. Later in the evening, he drove back at 20 km/hr less than the usual speed. Write a Java program to calculate: (a) The total time taken by the driver. (b) The average speed during the whole journey. [Hint: Average Speed = Total Distance / Total Time].Write a JAVA Program!!!!!!!!!!!!!!!!11

Answers

Answered by freedarajesh2003
2

Answer:

Explanation:

Answer:

Hey mate!!

Here's ur answer ..

class drive

{

public static void main (String args[ ])

{

int d ,s1,s2,tt,td,t1,t2;

Double avg;

d=240;

s1=60;

s2=60-20;

t1=d/s1;

t2=d/s2;

tt=t1+t2;

td=d*2;

avg = td/tt;

System.out.println(" Total time taken by driver =" +tt);

System.out.println ("Average speed ="+avg);

System.out.println ("Program ends");

}

}

HOPE IT HELPS!!!

please please please mark me as brainlist

Similar questions