Define a class with the following specifications: Create a class called MarathonRunner that has three private data members: name (String), distance (double) and time (double). b. a. Write a constructor that accepts name, distance, and time as input parameters to initialize the private data members. Provide only one accessor (get) method and one mutator (set) method for the distance data member. 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 = Define a public method called isFaster() that accepts as input parameter a speed record(double). The method should return true if the curTent runner's speed is faster than the speed record, otherwise, return false Define a public method called displayDetails() to display on the screen the runner's details as in the following sample: C. distance time Runner name: Ahmed Distance traveled: 11700 m Time elapsed: 2372.0 s Runner's Speed: 4.93 m/s

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 5E
icon
Related questions
Question
100%
Java
Define a class with the following specifications:
Create a class called MarathonRunner that has three private data members: name (String), distance
(double) and tìme (double).
b.
a.
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 (set) method for the distance data member.
d.
Define a private method called calculateSpeed() which calculates and returns the speed (double) of the
distance
marathon runner. The speed is calculated using the formula: speed =
time
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.
c.
Define a public method called displayDetails() 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 Speed: 4.93 m/s
Transcribed Image Text:Define a class with the following specifications: Create a class called MarathonRunner that has three private data members: name (String), distance (double) and tìme (double). b. a. 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 (set) method for the distance data member. d. Define a private method called calculateSpeed() which calculates and returns the speed (double) of the distance marathon runner. The speed is calculated using the formula: speed = time 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. c. Define a public method called displayDetails() 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 Speed: 4.93 m/s
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage