SlideShare a Scribd company logo
Hi,
I have modified the Point.java file as per your requirement.
Point.java
public class Point
{
double x, y;
public Point() {
x = 0;
y = 0;
}
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public double getX() { return x; }
public double getY() { return y; }
public double getRadius() { return Math.sqrt(x * x + y * y); }
public double getAngle() { return Math.atan2(y, x); }
}
import org.junit.*;
import static org.junit.Assert.*;
public class PointTest
{
private static final double TOLERANCE = 1E-12;
@Test public void testNoArg()
{
Point p = new Point();
assertEquals(0, p.getX(), TOLERANCE);
assertEquals(0, p.getY(), TOLERANCE);
assertEquals(0, p.getRadius(), TOLERANCE);
assertEquals(0, p.getAngle(), TOLERANCE);
}
@Test public void testXY()
{
Point p = new Point(3, 4);
assertEquals(3, p.getX(), TOLERANCE);
assertEquals(4, p.getY(), TOLERANCE);
assertEquals(5, p.getRadius(), TOLERANCE);
assertEquals(0.9272952180016122, p.getAngle(), TOLERANCE);
}
}
Solution
Hi,
I have modified the Point.java file as per your requirement.
Point.java
public class Point
{
double x, y;
public Point() {
x = 0;
y = 0;
}
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public double getX() { return x; }
public double getY() { return y; }
public double getRadius() { return Math.sqrt(x * x + y * y); }
public double getAngle() { return Math.atan2(y, x); }
}
import org.junit.*;
import static org.junit.Assert.*;
public class PointTest
{
private static final double TOLERANCE = 1E-12;
@Test public void testNoArg()
{
Point p = new Point();
assertEquals(0, p.getX(), TOLERANCE);
assertEquals(0, p.getY(), TOLERANCE);
assertEquals(0, p.getRadius(), TOLERANCE);
assertEquals(0, p.getAngle(), TOLERANCE);
}
@Test public void testXY()
{
Point p = new Point(3, 4);
assertEquals(3, p.getX(), TOLERANCE);
assertEquals(4, p.getY(), TOLERANCE);
assertEquals(5, p.getRadius(), TOLERANCE);
assertEquals(0.9272952180016122, p.getAngle(), TOLERANCE);
}
}

More Related Content

Similar to Hi,I have modified the Point.java file as per your requirement.P.pdf

662305 10
662305 10662305 10
Please help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfPlease help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdf
JUSTSTYLISH3B2MOHALI
 
Operator overloading (binary)
Operator overloading (binary)Operator overloading (binary)
Operator overloading (binary)
Ramish Suleman
 
Migrating to JUnit 5
Migrating to JUnit 5Migrating to JUnit 5
Migrating to JUnit 5
Rafael Winterhalter
 
AJUG April 2011 Cascading example
AJUG April 2011 Cascading exampleAJUG April 2011 Cascading example
AJUG April 2011 Cascading example
Christopher Curtin
 
C# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsC# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension Methods
Mohammad Shaker
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
fashioncollection2
 
662305 11
662305 11662305 11
culadora cientifica en java
culadora cientifica en javaculadora cientifica en java
culadora cientifica en java
Jorge Llocclla Rojas
 
Lecture 6.pptx
Lecture 6.pptxLecture 6.pptx
Lecture 6.pptx
vinayjod
 
Having a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfHaving a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdf
NicholasflqStewartl
 
Modul Praktek Java OOP
Modul Praktek Java OOP Modul Praktek Java OOP
Modul Praktek Java OOP
Zaenal Arifin
 
Martian Cubics and Unit TestingYou must implement all of the data .pdf
Martian Cubics and Unit TestingYou must implement all of the data .pdfMartian Cubics and Unit TestingYou must implement all of the data .pdf
Martian Cubics and Unit TestingYou must implement all of the data .pdf
ellanorfelicityri239
 
Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!
Daniel Pokusa
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
andyrobinson8
 
Joose @jsconf
Joose @jsconfJoose @jsconf
Joose @jsconfmalteubl
 
Create a class named Point that represent points in in three dimension.docx
Create a class named Point that represent points in in three dimension.docxCreate a class named Point that represent points in in three dimension.docx
Create a class named Point that represent points in in three dimension.docx
earleanp
 
This is to test a balanced tree. I need help testing an unbalanced t.pdf
This is to test a balanced tree. I need help testing an unbalanced t.pdfThis is to test a balanced tree. I need help testing an unbalanced t.pdf
This is to test a balanced tree. I need help testing an unbalanced t.pdf
akaluza07
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
anushkaent7
 

Similar to Hi,I have modified the Point.java file as per your requirement.P.pdf (20)

662305 10
662305 10662305 10
662305 10
 
Please help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfPlease help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdf
 
Operator overloading (binary)
Operator overloading (binary)Operator overloading (binary)
Operator overloading (binary)
 
Migrating to JUnit 5
Migrating to JUnit 5Migrating to JUnit 5
Migrating to JUnit 5
 
CSharp v1.0.2
CSharp v1.0.2CSharp v1.0.2
CSharp v1.0.2
 
AJUG April 2011 Cascading example
AJUG April 2011 Cascading exampleAJUG April 2011 Cascading example
AJUG April 2011 Cascading example
 
C# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsC# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension Methods
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
 
662305 11
662305 11662305 11
662305 11
 
culadora cientifica en java
culadora cientifica en javaculadora cientifica en java
culadora cientifica en java
 
Lecture 6.pptx
Lecture 6.pptxLecture 6.pptx
Lecture 6.pptx
 
Having a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfHaving a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdf
 
Modul Praktek Java OOP
Modul Praktek Java OOP Modul Praktek Java OOP
Modul Praktek Java OOP
 
Martian Cubics and Unit TestingYou must implement all of the data .pdf
Martian Cubics and Unit TestingYou must implement all of the data .pdfMartian Cubics and Unit TestingYou must implement all of the data .pdf
Martian Cubics and Unit TestingYou must implement all of the data .pdf
 
Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Joose @jsconf
Joose @jsconfJoose @jsconf
Joose @jsconf
 
Create a class named Point that represent points in in three dimension.docx
Create a class named Point that represent points in in three dimension.docxCreate a class named Point that represent points in in three dimension.docx
Create a class named Point that represent points in in three dimension.docx
 
This is to test a balanced tree. I need help testing an unbalanced t.pdf
This is to test a balanced tree. I need help testing an unbalanced t.pdfThis is to test a balanced tree. I need help testing an unbalanced t.pdf
This is to test a balanced tree. I need help testing an unbalanced t.pdf
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
 

More from anokhijew

we know that there is an OH group present in phen.pdf
                     we know that there is an OH group present in phen.pdf                     we know that there is an OH group present in phen.pdf
we know that there is an OH group present in phen.pdf
anokhijew
 
systems T and P are different from the reservoi.pdf
                     systems T and P are different from the reservoi.pdf                     systems T and P are different from the reservoi.pdf
systems T and P are different from the reservoi.pdf
anokhijew
 
Since X represents the solid phase, Y represents .pdf
                     Since X represents the solid phase, Y represents .pdf                     Since X represents the solid phase, Y represents .pdf
Since X represents the solid phase, Y represents .pdf
anokhijew
 
Pb^2+ may be present. .pdf
                     Pb^2+ may be present.                            .pdf                     Pb^2+ may be present.                            .pdf
Pb^2+ may be present. .pdf
anokhijew
 
P inversly proportional to 1V so answer is C .pdf
                     P inversly proportional to 1V so answer is C    .pdf                     P inversly proportional to 1V so answer is C    .pdf
P inversly proportional to 1V so answer is C .pdf
anokhijew
 
nutrinos are the smallest part of an atom. NOTE-.pdf
                     nutrinos are the smallest part of an atom. NOTE-.pdf                     nutrinos are the smallest part of an atom. NOTE-.pdf
nutrinos are the smallest part of an atom. NOTE-.pdf
anokhijew
 
Molecular solids are held together in single chai.pdf
                     Molecular solids are held together in single chai.pdf                     Molecular solids are held together in single chai.pdf
Molecular solids are held together in single chai.pdf
anokhijew
 
Liquid crystals (LCs) are a state of matter that .pdf
                     Liquid crystals (LCs) are a state of matter that .pdf                     Liquid crystals (LCs) are a state of matter that .pdf
Liquid crystals (LCs) are a state of matter that .pdf
anokhijew
 
interstellar medium (gas) Solution .pdf
                     interstellar medium (gas) Solution           .pdf                     interstellar medium (gas) Solution           .pdf
interstellar medium (gas) Solution .pdf
anokhijew
 
Hhyd = Hcrystallization + Hsolv Enthalpy of Solv.pdf
                     Hhyd = Hcrystallization + Hsolv  Enthalpy of Solv.pdf                     Hhyd = Hcrystallization + Hsolv  Enthalpy of Solv.pdf
Hhyd = Hcrystallization + Hsolv Enthalpy of Solv.pdf
anokhijew
 
The answer is (b) the condensation of steam to liiquid water.The e.pdf
The answer is (b) the condensation of steam to liiquid water.The e.pdfThe answer is (b) the condensation of steam to liiquid water.The e.pdf
The answer is (b) the condensation of steam to liiquid water.The e.pdf
anokhijew
 
XML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdf
XML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdfXML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdf
XML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdf
anokhijew
 
The Data recovery is of two types …One method is by using a softwa.pdf
The Data recovery is of two types …One method is by using a softwa.pdfThe Data recovery is of two types …One method is by using a softwa.pdf
The Data recovery is of two types …One method is by using a softwa.pdf
anokhijew
 
Thanks anon101. D is correctSolutionThanks anon101. D is corre.pdf
Thanks anon101. D is correctSolutionThanks anon101. D is corre.pdfThanks anon101. D is correctSolutionThanks anon101. D is corre.pdf
Thanks anon101. D is correctSolutionThanks anon101. D is corre.pdf
anokhijew
 
StudentData.javaimport java.util.Scanner; public class Student.pdf
StudentData.javaimport java.util.Scanner; public class Student.pdfStudentData.javaimport java.util.Scanner; public class Student.pdf
StudentData.javaimport java.util.Scanner; public class Student.pdf
anokhijew
 
Reverse EngineeringReverse engineering is also a back engineering .pdf
Reverse EngineeringReverse engineering is also a back engineering .pdfReverse EngineeringReverse engineering is also a back engineering .pdf
Reverse EngineeringReverse engineering is also a back engineering .pdf
anokhijew
 
Quantum mechanics predicts the existence of what are usually called .pdf
Quantum mechanics predicts the existence of what are usually called .pdfQuantum mechanics predicts the existence of what are usually called .pdf
Quantum mechanics predicts the existence of what are usually called .pdf
anokhijew
 
Program Educational Objectives • To create competencies and opportun.pdf
Program Educational Objectives • To create competencies and opportun.pdfProgram Educational Objectives • To create competencies and opportun.pdf
Program Educational Objectives • To create competencies and opportun.pdf
anokhijew
 
P2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdf
P2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdfP2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdf
P2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdf
anokhijew
 
cant understand a thing .pdf
                     cant understand a thing                          .pdf                     cant understand a thing                          .pdf
cant understand a thing .pdf
anokhijew
 

More from anokhijew (20)

we know that there is an OH group present in phen.pdf
                     we know that there is an OH group present in phen.pdf                     we know that there is an OH group present in phen.pdf
we know that there is an OH group present in phen.pdf
 
systems T and P are different from the reservoi.pdf
                     systems T and P are different from the reservoi.pdf                     systems T and P are different from the reservoi.pdf
systems T and P are different from the reservoi.pdf
 
Since X represents the solid phase, Y represents .pdf
                     Since X represents the solid phase, Y represents .pdf                     Since X represents the solid phase, Y represents .pdf
Since X represents the solid phase, Y represents .pdf
 
Pb^2+ may be present. .pdf
                     Pb^2+ may be present.                            .pdf                     Pb^2+ may be present.                            .pdf
Pb^2+ may be present. .pdf
 
P inversly proportional to 1V so answer is C .pdf
                     P inversly proportional to 1V so answer is C    .pdf                     P inversly proportional to 1V so answer is C    .pdf
P inversly proportional to 1V so answer is C .pdf
 
nutrinos are the smallest part of an atom. NOTE-.pdf
                     nutrinos are the smallest part of an atom. NOTE-.pdf                     nutrinos are the smallest part of an atom. NOTE-.pdf
nutrinos are the smallest part of an atom. NOTE-.pdf
 
Molecular solids are held together in single chai.pdf
                     Molecular solids are held together in single chai.pdf                     Molecular solids are held together in single chai.pdf
Molecular solids are held together in single chai.pdf
 
Liquid crystals (LCs) are a state of matter that .pdf
                     Liquid crystals (LCs) are a state of matter that .pdf                     Liquid crystals (LCs) are a state of matter that .pdf
Liquid crystals (LCs) are a state of matter that .pdf
 
interstellar medium (gas) Solution .pdf
                     interstellar medium (gas) Solution           .pdf                     interstellar medium (gas) Solution           .pdf
interstellar medium (gas) Solution .pdf
 
Hhyd = Hcrystallization + Hsolv Enthalpy of Solv.pdf
                     Hhyd = Hcrystallization + Hsolv  Enthalpy of Solv.pdf                     Hhyd = Hcrystallization + Hsolv  Enthalpy of Solv.pdf
Hhyd = Hcrystallization + Hsolv Enthalpy of Solv.pdf
 
The answer is (b) the condensation of steam to liiquid water.The e.pdf
The answer is (b) the condensation of steam to liiquid water.The e.pdfThe answer is (b) the condensation of steam to liiquid water.The e.pdf
The answer is (b) the condensation of steam to liiquid water.The e.pdf
 
XML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdf
XML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdfXML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdf
XML Extensiable Markup LanguageHTML Hypertext Markup LanguageD.pdf
 
The Data recovery is of two types …One method is by using a softwa.pdf
The Data recovery is of two types …One method is by using a softwa.pdfThe Data recovery is of two types …One method is by using a softwa.pdf
The Data recovery is of two types …One method is by using a softwa.pdf
 
Thanks anon101. D is correctSolutionThanks anon101. D is corre.pdf
Thanks anon101. D is correctSolutionThanks anon101. D is corre.pdfThanks anon101. D is correctSolutionThanks anon101. D is corre.pdf
Thanks anon101. D is correctSolutionThanks anon101. D is corre.pdf
 
StudentData.javaimport java.util.Scanner; public class Student.pdf
StudentData.javaimport java.util.Scanner; public class Student.pdfStudentData.javaimport java.util.Scanner; public class Student.pdf
StudentData.javaimport java.util.Scanner; public class Student.pdf
 
Reverse EngineeringReverse engineering is also a back engineering .pdf
Reverse EngineeringReverse engineering is also a back engineering .pdfReverse EngineeringReverse engineering is also a back engineering .pdf
Reverse EngineeringReverse engineering is also a back engineering .pdf
 
Quantum mechanics predicts the existence of what are usually called .pdf
Quantum mechanics predicts the existence of what are usually called .pdfQuantum mechanics predicts the existence of what are usually called .pdf
Quantum mechanics predicts the existence of what are usually called .pdf
 
Program Educational Objectives • To create competencies and opportun.pdf
Program Educational Objectives • To create competencies and opportun.pdfProgram Educational Objectives • To create competencies and opportun.pdf
Program Educational Objectives • To create competencies and opportun.pdf
 
P2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdf
P2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdfP2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdf
P2O5 removes H2O from Alcohol to form Alkene O of Alcohol gives it.pdf
 
cant understand a thing .pdf
                     cant understand a thing                          .pdf                     cant understand a thing                          .pdf
cant understand a thing .pdf
 

Recently uploaded

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 

Hi,I have modified the Point.java file as per your requirement.P.pdf

  • 1. Hi, I have modified the Point.java file as per your requirement. Point.java public class Point { double x, y; public Point() { x = 0; y = 0; } public Point(double x, double y) { this.x = x; this.y = y; } public double getX() { return x; } public double getY() { return y; } public double getRadius() { return Math.sqrt(x * x + y * y); } public double getAngle() { return Math.atan2(y, x); } } import org.junit.*; import static org.junit.Assert.*; public class PointTest { private static final double TOLERANCE = 1E-12; @Test public void testNoArg() { Point p = new Point(); assertEquals(0, p.getX(), TOLERANCE); assertEquals(0, p.getY(), TOLERANCE); assertEquals(0, p.getRadius(), TOLERANCE); assertEquals(0, p.getAngle(), TOLERANCE); } @Test public void testXY() {
  • 2. Point p = new Point(3, 4); assertEquals(3, p.getX(), TOLERANCE); assertEquals(4, p.getY(), TOLERANCE); assertEquals(5, p.getRadius(), TOLERANCE); assertEquals(0.9272952180016122, p.getAngle(), TOLERANCE); } } Solution Hi, I have modified the Point.java file as per your requirement. Point.java public class Point { double x, y; public Point() { x = 0; y = 0; } public Point(double x, double y) { this.x = x; this.y = y; } public double getX() { return x; } public double getY() { return y; } public double getRadius() { return Math.sqrt(x * x + y * y); } public double getAngle() { return Math.atan2(y, x); } } import org.junit.*; import static org.junit.Assert.*; public class PointTest { private static final double TOLERANCE = 1E-12; @Test public void testNoArg()
  • 3. { Point p = new Point(); assertEquals(0, p.getX(), TOLERANCE); assertEquals(0, p.getY(), TOLERANCE); assertEquals(0, p.getRadius(), TOLERANCE); assertEquals(0, p.getAngle(), TOLERANCE); } @Test public void testXY() { Point p = new Point(3, 4); assertEquals(3, p.getX(), TOLERANCE); assertEquals(4, p.getY(), TOLERANCE); assertEquals(5, p.getRadius(), TOLERANCE); assertEquals(0.9272952180016122, p.getAngle(), TOLERANCE); } }