What are the Javadoc comments for each class? I am struggling

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
What are the Javadoc comments for each class? I am struggling
=> TestVector3D.java
/Testvector3D. java
import org.junit.Assert;
Emport org.junit.Test;
public elass TestVector 3D {
// test for getMagnitude
eTest
publie void testMagnitude() (
Vector3D vectorl - new Vector3D(20, 10, 25):
Vector3D vector2 - new Vector3D(15, 25, 30);
Assert.assertEquals (33.54101966249684, vector1.getMagnitude (), 0):
Assert.assertEquals(41.83300132670378, vector2.getNagnitude(), 0)1
// Test for normalize
eTest
public void testNormalize() (
Vector3D vectori - new Vector3D(20, 10, 25);
Vector3D vector2 - new Vector3D( 15, 25, 30);
Assert.assertEquals("(0.5962847939999439,0.29814239699997197,0.7453559924999299)", vector1.normalize().tostring(0):
Assert.assertEquals("(0.35856858280031806,0.5976143046671968,0.7171371656006361}", vector2.normalize().tostring():
// Test for Add
eTest
public void testAdd() (
Vector3D vectorl - new Vector3D(20, 10, 25):
Vector3D vector2 - new Vector3D(15, 25, 30);
Assert.assertEquals("(35.0,35.0,55.0)", vector1.add(vector2).tostring 0):
// Test for multiply
eTest
public void testMultiply() {
Vector3D vectorl- new Vector3D(20, 10, 25):
Assert.assertEquals("(200.0,100.0,250.0}", vector1.multiply(10). tostring()):
// Test for dotProduct
Test
public void testDotProduct () (
Vector3D vectorl - new Vector3D(20, 10, 25);
Vector3D vector2 new Vector3D(15, 25, 30);
Assert.assertEquals(1300.0, vector1.dotProduct (vector2), O)
// Test for Exception
eTest
public void testException() (
Vector3D vectori - new Vector3D(0, o, 0);
try (
vector1.normalize():
} catch (Exception ex) (
Assert.assertEquals("Error, Vector cannot be nornalized", ex.getMessage()):
Il=> Vector3D.java
/Vector 3D.java
public class Vector3D (
private double x:
private double yi
private double z
public Vector3D( double x, double y, double z) {
this.x - x;
this.y- y:
this.z z:
public double getX() {
return x;
public double getY() {
return y
publie double get2() {
return z
public double getMagnitude() (
return Math.sqrt(x x + yy+ z 2);
eoverride
public String tostring() {
return (" + x+,+y ", ++ "}";
public Vector3D normalize() {
double mag - getMagnitude):
it (Double.compare(0, mag) - 0) {
throw new IllegalstateException ( "Error, Vector cannot be normalized");
} else {
return new Vector3D(x / nag, y / mag, z/ nag):
public Vector3D add(Vector 3D vector3D) {
double xx - x + vector 3D. getX();
double yy y + vector 3D. getY())
double zz - + vector 3D. getz();
return new Vector3D(XX, yy. zz):
public Vector3D multiply(double factor) {
double xx = x• factor;
double yy - y• factor;
double zz - * factor:
return new Vector3D(XX, yy. zz):
public double dotProduct (Vector 3D vector3D) {
double xx -x vector 3D. getx():
double yy -y vector 3D. getY():
double zz - vector 3D. getz():
return xx + yy + z2
public double anglebetveen (Vector3D vector 3D) {
double den - getMagnitude () + vector3D.getMagnitude ();
if (Double.compare(0, den) - 0){
throw new IllegalstateException("Error, Vector cannot be normalized");
} else {
return Math.acos (dotProduct(vector3D) / den))
Transcribed Image Text:=> TestVector3D.java /Testvector3D. java import org.junit.Assert; Emport org.junit.Test; public elass TestVector 3D { // test for getMagnitude eTest publie void testMagnitude() ( Vector3D vectorl - new Vector3D(20, 10, 25): Vector3D vector2 - new Vector3D(15, 25, 30); Assert.assertEquals (33.54101966249684, vector1.getMagnitude (), 0): Assert.assertEquals(41.83300132670378, vector2.getNagnitude(), 0)1 // Test for normalize eTest public void testNormalize() ( Vector3D vectori - new Vector3D(20, 10, 25); Vector3D vector2 - new Vector3D( 15, 25, 30); Assert.assertEquals("(0.5962847939999439,0.29814239699997197,0.7453559924999299)", vector1.normalize().tostring(0): Assert.assertEquals("(0.35856858280031806,0.5976143046671968,0.7171371656006361}", vector2.normalize().tostring(): // Test for Add eTest public void testAdd() ( Vector3D vectorl - new Vector3D(20, 10, 25): Vector3D vector2 - new Vector3D(15, 25, 30); Assert.assertEquals("(35.0,35.0,55.0)", vector1.add(vector2).tostring 0): // Test for multiply eTest public void testMultiply() { Vector3D vectorl- new Vector3D(20, 10, 25): Assert.assertEquals("(200.0,100.0,250.0}", vector1.multiply(10). tostring()): // Test for dotProduct Test public void testDotProduct () ( Vector3D vectorl - new Vector3D(20, 10, 25); Vector3D vector2 new Vector3D(15, 25, 30); Assert.assertEquals(1300.0, vector1.dotProduct (vector2), O) // Test for Exception eTest public void testException() ( Vector3D vectori - new Vector3D(0, o, 0); try ( vector1.normalize(): } catch (Exception ex) ( Assert.assertEquals("Error, Vector cannot be nornalized", ex.getMessage()): Il=> Vector3D.java /Vector 3D.java public class Vector3D ( private double x: private double yi private double z public Vector3D( double x, double y, double z) { this.x - x; this.y- y: this.z z: public double getX() { return x; public double getY() { return y publie double get2() { return z public double getMagnitude() ( return Math.sqrt(x x + yy+ z 2); eoverride public String tostring() { return (" + x+,+y ", ++ "}"; public Vector3D normalize() { double mag - getMagnitude): it (Double.compare(0, mag) - 0) { throw new IllegalstateException ( "Error, Vector cannot be normalized"); } else { return new Vector3D(x / nag, y / mag, z/ nag): public Vector3D add(Vector 3D vector3D) { double xx - x + vector 3D. getX(); double yy y + vector 3D. getY()) double zz - + vector 3D. getz(); return new Vector3D(XX, yy. zz): public Vector3D multiply(double factor) { double xx = x• factor; double yy - y• factor; double zz - * factor: return new Vector3D(XX, yy. zz): public double dotProduct (Vector 3D vector3D) { double xx -x vector 3D. getx(): double yy -y vector 3D. getY(): double zz - vector 3D. getz(): return xx + yy + z2 public double anglebetveen (Vector3D vector 3D) { double den - getMagnitude () + vector3D.getMagnitude (); if (Double.compare(0, den) - 0){ throw new IllegalstateException("Error, Vector cannot be normalized"); } else { return Math.acos (dotProduct(vector3D) / den))
Expert Solution
Introduction

Javadocs are the multi line comments written for each and every method describing parameters and return type

 

Note: only Javadocs are implemented as you already have declaration and implementation of class

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY