Question
Intro to JAVA Course see below: _______________________________ The Segment class describes a segment of the real line with a given start and end point. Have
Intro to JAVA Course see below:
_______________________________
The Segment class describes a segment of the real line with a given start and end point. Have the class implement the Measurable interface. The measure of a segment is the length. For example, the segment from 1 to 5 has length 4, as does the segment from 5 to 1.
CODE:
public class Segment { private double start; private double end;
/** Constructs a linear segment. @param from the starting point @param to the ending point */ public Segment(double from, double to) { start = from; end = to; }
public String toString() { return start + "->" + end; } }
Measurable.java 1 2 Describes any class whose objects can be measured 4 public interface Measurable k x Computes the measure of the object. @return the measure 10 double getMeasure()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started