Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

help /prog/!

Name: Anonymous 2011-11-08 16:06

this assignment is killing me!

Let us begin to apply OOP by creating a Class called Waypoint that extends the class Point2D.Double (from the package java.awt.geom) that is already provided with the Java language (you should check the online Java API Documentation for more details) and adding fields for the speed (a double) and the street (a String).

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 waypoints with the speed and street between them, but we can simplify for this assignment. As a result, we will treat routes as if there is only one way to get from any one waypoint to the next, and therefore can store the speed and street with the "from" waypoint, and calculate the distance and time to the "to" waypoint.
The Point2D class that Java provides is a bit strange looking at first because it contains nested classes for the implementation of a Point with either type double or type float members, but you just import java.awt.geom.point2D and then extend Point2D.Double so don't worry about the strange syntax with the extra dot (.) for now – it will work.
Now let us also create an Interface called Travelable (see the Payable interface in chapter 10 for a referential example) that provides for abstract method toDistance that takes another Waypoint as a parameter and returns the distance from this Waypoint to the one passed, as a type double; and abstract method toTime that also takes another Waypoint as a parameter and returns the travel time from this Waypoint 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 same Pythagorean Theorum we've already developed and coded in the previous lab.

so far i have

import java.awt.geom.Point2D;

public class abstract Waypoint implements Travelable {
{
    private float speed;
    private string street;
    private string fromWayPoint;
    private string toWayPoint;
   
    //constructor
    public Travelable( String part, String description, int count, double speed)

}
    //set speed
    public double getSpeed()
    {
        return Speed;
    } // end method get speed
   
    //set distance
    public String getDistance()
    {
    return Distance;
    } // end method get distance
   

but i don't know what else to do! i am lost! please help

Name: Anonymous 2011-11-08 16:08

is there anyone here??

Name: Anonymous 2011-11-08 16:31

no.

Name: Anonymous 2011-11-08 21:10

THEN WHO WAS PHONE?

Name: Anonymous 2011-11-08 22:00

I have trouble comprehending your post. Perhaps if you would upload a picture representation of your problem, I may find it easier to comprehend.

Don't change these.
Name: Email:
Entire Thread Thread List