Monday, 30 October 2017

Introduction to Java program



Problem 1.12
                   Assume a runner runs 24 miles in 1 hour, 40 minutes,
and 35 seconds. Write a program that displays the average speed in kilometers per
hour.

Description
 Note that 1 mile is 1.6 kilometers.

Solution
              public class Message {

    public static void main(String[] args) {
         
        System.out.println("Total KM/h = "+(24*1.6));
        } }

Output:



No comments:

Post a Comment