Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Instructions We have completed our study of the object-oriented design sections of the course (Encapsulation in chapter 8 Inheritance in chapter 9 and Polymorphism

image text in transcribed

image text in transcribed

image text in transcribed

Assignment Instructions We have completed our study of the object-oriented design sections of the course (Encapsulation in chapter 8 Inheritance in chapter 9 and Polymorphism in chapter 10). We will begin to practice OOD by extending one of the Java classes to implement a Waypoint suitable for simple GPS applications and implementing our own interface for objects that can be navigated in a route. First, create an Interface called Travelable (see the Payable interface in chapter 10 for a referential example) that provides .Abstract method toDistance that takes another Travelable object as a parameter (i.e., a Waypoint would be one kind of Travelable object) and returns the distance from this Travelable to the one passed, as a type double. . Abstract method toTime that also takes another Travelable (like for instance, a Waypoint) as a parameter and returns the travel time from this Travelable to the one passed, as a type double, by using the speed of this Waypoint as the velocity to factor in the calculation. Of course these calculations are from the sam Pythagorean Theorum we've already developed and coded in previous lab activities Abstract method getPoint that takes no parameters and returns the x and y Point2DDouble coordinates of this Travelable (as a Point2DDouble). Second, create a Class called Waypoint that extends the class Point2D,Double (from the packag java.awt.geom) that is already provided with the Java language (you should check the online Java AP Documentation for more details) and implements the above Interface. It should also override the toString and equals methods. The result will provide us with access to x and y coordinates implemented as double-precision values, but will also add fields for the speed (as a double) that will be used to get from that location to the next, and the street (as a String) that will be traveled to get from that location to the next. The speed will be the velocity to the next waypoint and the street will be the name of the street to take to the next waypoint. In the "real world" we would probably create another data structure that associated two fore nnints with the speed and street between them, but we are simplifying this for our current assignment. As a

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

Students also viewed these Databases questions

Question

Question What integration level should an employer choose?

Answered: 1 week ago