Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

classes help java please question: define a class with the following specifactions: a. create a class called MarathonRunner that has three private data members: name

classes help java please
question: define a class with the following specifactions:
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 inatialize 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 teturns the speed (double) of the marathon runner. the speed is calculated using the formula speed= distance/time.
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.
f. 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
then
Write a Java application to do the following:
a- Asks the user to enter a runner's first name, distance traveled and time elapsed. Create an object called runner1 from class MarathonRunner you defined in previous question and set its values according to the input data. b.
b. Display the details of runner1.
c. Display the message You broke the speed record" if runner1 is faster than the speed record of value 6.7 (m/s).
please help as soon as possible i would appreciate if the code was simple basic java code with no arrays[] nothing complex
thank you so much
image text in transcribed
image text in transcribed
Define a class with the following specifications: a b C. distance e. Create a class called MarathonRunner that has three private data members, name (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 = 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. f. 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 Speed: 4.93 m/s a Write a Java application to do the following: Asks the user to enter a runner's first name, distance traveled and time elapsed. Create an object called runnerl from class Marathon Runner you defined in previous question and set its values according to the input data. b. Display the details of runner1. c. Display the message "You broke the speed record" if runnerl is faster than the speed record of value 6.7 (m/s)

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

Step: 3

blur-text-image

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

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

=+ 4. Why should policymakers think about incentives?

Answered: 1 week ago

Question

=+ 2. What is the opportunity cost of seeing a movie?

Answered: 1 week ago

Question

=+ what roles should government play in them ?

Answered: 1 week ago