• having no parameter – for setting values to zero or null. • having two parameters for assigning values to both data members. • Overload the above constructor and use this keyword to set the values of data members. • Provide getters/setters for data members. • A function which calculates and display speed of traveling. • Write a function show() displays values.
Write a class Travel having two private data members (distanceCovered , Time)
The class has three constructors which are
• having no parameter – for setting values to zero or null.
• having two parameters for assigning values to both data members.
• Overload the above constructor and use this keyword to set the values of data members.
• Provide getters/setters for data members.
• A function which calculates and display speed of traveling.
• Write a function show() displays values.
Write test Application that demonstrates the Run class by calling all the three constructors and method, creating a Create Travel objects, and then display the traveling with speed. Calculate highest speed.
Step by step
Solved in 2 steps with 3 images