Question: Create a class called MarathonRunner that has three private data members: name (String), distance [double) and time (double). Write a costruclar that accepls name, distance,


Create a class called MarathonRunner that has three private data members: name (String), distance [double) and time (double). Write a costruclar that accepls name, distance, and time as input paramalas to initialize the private data members Pravide only one axes (pel) method and one mutatar (selj method for the dialana dala member. d. Define a private method called calculateSpeed() which calculates and retums the speed (double) of the disane marathon runner. The speed is calculated using the formula: speed = Define a public methad called islastenttll accept as mput parameter a speed recordedouble. The methodould turn true il me eument nunner's speed is faster than the speed board. ethenes. return Deline a publike method called display Delaiketo display on the server the nurner's details as in the following sample Runner namc: Ahmed Distance traveled: ETIRI m Tume elapsed: 23720 5 Runner's Speed 1.93 mis Write a Java application to do the following: a Asks the user to enter a numer's first name, distance traveled and time elapsed Create an object called runnerl from class Marathon Runner you delined in previous question and set 315 values according to the input dati. ha Display the details at runnerl. 6. Display the message "You broke the speed record" if runnerl is faster than the speed record
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
