Menu
Question Index
...

Write a program to get the distance traveled by a person, given the number of hours traveled by person and the average speed.

Input Output
hours = 3.0 and average speed = 6.0 distance traveled by a person = 18.0
hours = 5.0 and average speed = 2.5 distance traveled by a person = 12.5
hours = 1.5 and average speed = 2.5 distance traveled by a person = 3.75



class CalculateDistance
{
    public static void main(String s[])
    {
        double totalDistance = calculateDistance(5, 10);
        System.out.println("The total distance traveled by a person is " + totalDistance);

    }


        public static double calculateDistance(double hours, double speed)
        {
        }

}
        

Doubts

Problems

Topic: Basic Arithmetic Operators In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App