1 2 |
/**<br /> *<br /> * @Author: Aghatise Osazuwa<br /> * Website: www.cscprogrammingtutorials.com<br /> *<br /> * Exercise 1.12 - Average Speed In Kilometers<br /> *<br /> */ <br /><br />public class Ex1_12 {<br /> public static void main(String[] args) {<br /> System.out.println("Distance = 24 miles =" + (24.0 * 1.6) + " kilometersn");<br /> System.out.println("Time = 1 hour 40 minutes 35 seconds" + " = "<br /> + (1 + (((40.0 * 60.0) + 35.0) / 3600)) + " hours.n");<br /> System.out.print("Average Speed In kilometers per hour = ");<br /> System.out.println(((24.0 * 1.6) / (1 + (((40.0 * 60.0) + 35.0) / 3600)))<br /> + " kph.");<br /> }<br />} |
Program Output |
Click here to see other solutions to Introduction to Java Programming.