Draw the UML DIAGRAM ALSO


PLEASE DRAW THE UML DIAGRAM.ALSO
in java
should use the program in java
/******************************Point3D.java******************************/
public class Point3D {
/*
* data field
*/
private double x;
private double y;
private double z;
private String color;
/*
* no argument constructor
*/
public Point3D() {
this.x = 0.0;
this.y = 0.0;
this.z = 0.0;
this.color = "RED";
}
/**
*
* @param x
* @param y
* @param z
* @param color
*/
public Point3D(double x, double y, double z, String
color) {
super();
this.x = x;
this.y = y;
this.z = z;
this.color = color;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
public String getColor() {
return color;
}
public double distance(Point3D point) {
return Math.sqrt(Math.pow(this.x
- point.x, 2) + Math.pow(this.y - point.y, 2) + Math.pow(this.z -
point.z, 2));
}
public double distance(Point3D point1, Point3D point2) {
return Math.sqrt(
Math.pow(point1.x - point2.x, 2) +
Math.pow(point1.y - point2.y, 2) + Math.pow(point1.z - point2.z,
2));
}
@Override
public String toString() {
return "[" + x + "," + y + "," + z
+"]";
}
}
/**********************************TestPoint3D.java*************************************/
public class TestPoint3D {
public static void main(String[] args) {
Point3D[] points = new Point3D[10];
/*
* creating 10 objects of
Point3D
*/
points[0] = new Point3D();
points[1] = new Point3D(1.0, 1.0,
1.0, "Blue");
points[2] = new Point3D(2.0, 3.0,
4.0, "Blue");
points[3] = new Point3D(1.0, 5.0,
5.0, "Blue");
points[4] = new Point3D(1.0, 3.0,
1.0, "Blue");
points[5] = new Point3D(1.0, 5.0,
1.0, "Blue");
points[6] = new Point3D(1.0, 9.0,
15.0, "Blue");
points[7] = new Point3D(21.0, 14.0,
19.0, "Blue");
points[8] = new Point3D(13.0, 13.0,
10.0, "Blue");
points[9] = new Point3D(51.0, 31.0,
18.0, "Blue");
/*
* check the distance function
*/
System.out.printf("The distance
between points is:%.2f ", points[1].distance(points[2]));
System.out.printf("\nThe distance
between two points is:%.2f ", points[1].distance(points[2],
points[3]));
/*
* calling method max and min
*/
max(points);
min(points);
}
/*
* to calculate max distance between points call
distance(point1, point2) assign
* maxDistance to max value of double then compare each
value of distance with
* maxDistance if greater than then assign it to
maxDistance and assign points
* to point1, and point2
*/
private static void max(Point3D[] points) {
double maxDistance =
Double.MIN_VALUE;
Point3D point1 = null;
Point3D point2 = null;
for (int i = 0; i <
points.length; i++) {
for (int j = i + 1; j < points.length; j++) {
double distance1 = points[0].distance(points[i],
points[j]);
if (distance1 > maxDistance) {
maxDistance =
distance1;
point1 = points[i];
point2 = points[j];
}
}
}
System.out.printf("\n\nThe max
distance is %.2f ", maxDistance);
System.out.println("\nThe Points
pair is : " + point1.toString() + " and " +
point2.toString());
}
/*
* to calculate minimum distance between points call
distance(point1, point2)
* assign minDistance to max value of double then
compare each value of distance
* with maxDistance if less than then assign it to
minDistance and assign points
* to point1, and point2
*/
private static void min(Point3D[] points) {
double minDistance =
Double.MAX_VALUE;
Point3D point1 = null;
Point3D point2 = null;
for (int i = 0; i <
points.length; i++) {
for (int j = i + 1; j < points.length; j++) {
double distance1 = points[0].distance(points[i],
points[j]);
if (distance1 < minDistance) {
minDistance =
distance1;
point1 = points[i];
point2 = points[j];
}
}
}
System.out.printf("\nThe min
distance is %.2f ", minDistance);
System.out.println("\nThe Points
pair is : " + point1.toString() + " and " +
point2.toString());
}
}
/************************output**********************************/
The distance between points is:3.74
The distance between two points is:2.45
The max distance is 62.34
The Points pair is : [0.0,0.0,0.0] and [51.0,31.0,18.0]
The min distance is 1.73
The Points pair is : [0.0,0.0,0.0] and [1.0,1.0,1.0]
![Console X <terminated> TestPoint3D [Java Application] C:\Program FilesJava\ire1.8.0 131binljav The distance between points is](http://img.homeworklib.com/images/29db6e24-20d0-4e76-9b6c-b23648a65019.png?x-oss-process=image/resize,w_560)

You can edit this uml here
https://creately.com/diagram/jvk9vzzr2/pb0qC7SjCEMev9CXJNmTxw0iZs%3D
Please let me know if you have any doubt or modify this answer, Thanks :)
Draw the UML DIAGRAM ALSO PLEASE DRAW THE UML DIAGRAM.ALSO in java should use the program in java For this task you will create a Point3D class to represent a point that has coordinates in thr...
Design a class named MyPoint to represent a point with x and y-coordinates. The class contains: Two data fields x and y that represent the coordinates. . A no-arg constructor that creates a point (0, 0) .A constructor that constructs a point with specified coordinates. Two get functions for data fields x and y, respectively. A function named distance that returns the distance from this point to another point of the MyPoint type Write a test program that creates two...
Please create a UML for a class called Employee It will have a lastName as a String It will have a salary as a double It will have vacDays as an int It will have a no argument constructor that sets lastName to null, salary to 0.0 and vacation days to 15 It will have an argument constructor. It will have 3 accessor and 3 mutator methods It will have a showInfo() as a void method to display all the...
NEEDS TO BE IN PYTHON: (The Point class) Design a class named Point to represent a point with x- and y-coordinates. The class contains: - Two private data fields x and y that represent the coordinates with get methods. - A constructor that constructs a point with specified coordinates, with default point (0, 0). - A method named distance that returns the distance from this point to another point of the Point type. - A method named isNearBy(p1) that returns...
Inheritance Problem: (C++) (The MyPoint class) Design a class named MyPoint to represent a point with x-and y-coordinates. The class contains: Two data fields x and y that represent the coordinates. A no-arg constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates using passed in arguments. Two get functions for data fields x and y, respectively. A method named distance that returns the distance from this point to another point of the MyPoint...
Please use Java to answer the question. (The Rectangle class) Following the example of the Circle class in Section 8.2, design a class named Rectangle to represent a rectangle. The class contains: ■ Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. ■ A no-arg constructor that creates a default rectangle. ■ A constructor that creates a rectangle with the specified width...
Java code for the following inheritance hierarchy figure..
1. Create class Point, with two private
instance variables x and y that represented for the coordinates for
a point.
Provide constructor for initialising two instance variables.
Provide set and get methods
for each instance variable,
Provide toString method to return formatted
string for a point coordinates.
2. Create class Circle, its inheritance from
Point.
Provide a integer private
radius instance variable.
Provide constructor to
initialise the center coordinates and radius for...
In this assignment, you will implement Address and Residence classes. Create a new java project. Part A Implementation details of Address class: Add and implement a class named Address according to specifications in the UML class diagram. Data fields: street, city, province and zipCode. Constructors: A no-arg constructor that creates a default Address. A constructor that creates an address with the specified street, city, state, and zipCode Getters and setters for all the class fields. toString() to print out all...
Given the following construct a UML diagram for Java: Design a class named location for locating a maximal value and its location in a two-dimensional array. The class contains public data fields row, column, and maxValue that store the maximum value and its indices in a two-dimensional array with row and column as int types and maxValue as double type. Write the following method that returns the location of the largest element in two-dimensional array: Public static Location locateLargest(double[][] a)...
1. Please write the following program in Python 3. Also, please create a UML and write the test program. Please show all outputs. (The Fan class) Design a class named Fan to represent a fan. The class contains: Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed. A private int data field named speed that specifies the speed of the fan. A private bool data field named on that specifies...
JAVA design a class named Rectangle to represent a rectangle. The class contains: A method named getPerimeter() that returns the perimeter. Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. A no-arg constructor that creates a default rectangle. A constructor that creates a rectangle with the specified width and height. A method named getArea() that returns the area of this rectangle. design...