Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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).

image text in transcribed

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). a. Write a constructor that accepts name, distance, and time as input parameters to initialize the private data members. b. Provide only one accessor (get) method and one mutator (set) method for the distance data member. c. d. Define a private method called calculateSpeed(0 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. e. Define a public method called displayDetails() to display on the screen the runner's details as in the f. following Please write (in java) as possible

Define a class with the following specifications: b e. time Create a class called Marathon Runner that has three private data members, wame(String distance (double) and time (double). 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 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 Define a public method called is Faster() 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. 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 f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

Work out a Porter's Five Forces analysis on Duracell.

Answered: 1 week ago

Question

Format memos and e-mail properly.

Answered: 1 week ago

Question

=+How should it be delivered?

Answered: 1 week ago

Question

=+4 How does one acquire a global mindset?

Answered: 1 week ago