0% found this document useful (0 votes)
3 views2 pages

Java Marathon Runner Speed Calculator

The document contains a Java class named 'MarathonRunner' that captures a runner's name, distance, and time. It includes methods to calculate the runner's speed and display their details. However, the main method is incorrectly defined as static and lacks proper execution flow for the program.

Uploaded by

ahmed.t4a3
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Java Marathon Runner Speed Calculator

The document contains a Java class named 'MarathonRunner' that captures a runner's name, distance, and time. It includes methods to calculate the runner's speed and display their details. However, the main method is incorrectly defined as static and lacks proper execution flow for the program.

Uploaded by

ahmed.t4a3
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import [Link].

Scanner;

public class MarathonRunner

private String name;

private double distance;

private double time;

private static void main(String[]args)

String name="";

double distance,time;

Scanner kbd=new Scanner([Link]);

[Link]("write the name, distance and time");

name= [Link]();

distance= [Link]();

time= [Link]();

public void calculateSpeed()

double speed;

speed=distance/time;

public void displayDetails()

[Link]("Runner name:"+name);

[Link]("Distance traveled:"+distance+"m");
[Link]("Time elapsed:"+time+"s");

You might also like