Question: JAVA PPOGRAM ... Define a class with the following specifications: a. Create a class called MarathonRunner that has three private data members: name (String), distance

JAVA PPOGRAM  JAVA PPOGRAM ... Define a class with the following specifications: a.
Create a class called MarathonRunner that has three private data members: name

... Define a class with the following specifications: a. Create a class called MarathonRunner that has three private data members: name (String), distance (double) and time (double). b. Write a constructor that accepts name, distance, and time as input parameters to initialize the private data members. c. Provide only one accessor (get) method and one mutator (sct) method for the distance data member. d. Define a private method called calculateSpeed() which calculates and returns the speed (double) of the marathon runner. The speed is calculated using the formula: speed distance e. Define a public method called isFaster() that accepts as input parameter a speed record(double). The method should return true if the current runner's speed is faster than the speed record, otherwise, return false. 1. Define a public method called display Details to display on the screen the runner's details as in the following sample: Runner name: Ahmed Distance traveled: 11700 m Time elapsed: 2372.0 s Runner's Specd: 4.93 m/s Write a Java application to do the following: 2. Asks the user to enter a runner's first name, distnce traveled and time elapsed. Create an object called runnerl from class MarathonRunner you defined in previous question and set its values according to the input data. b. Display the details of runnerl. c. Display the message "You broke the speed record i runnerl is faster than the speed record of value 6.7 (m/s)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!