SlideShare a Scribd company logo
1 of 3
Download to read offline
Point.java
public class Point
{
int x,y;
double m,n;
public Point(){}
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); }
public static Point of(int i,int j)
{
Point p=new Point();
p.x=i;
p.y=j;
return p;
}
public static Point ofPolar(double i,double j)
{
Point p=new Point();
p.m=i;
p.n=j;
return p;
}
}
PointTest.java
import org.junit.*;
import static org.junit.Assert.*;
public class PointTest
{
private static final double TOLERANCE = 1E-12;
@Test public void testOf1()
{
Point p = Point.of(1, -1);
assertEquals(1, p.getX(), TOLERANCE);
assertEquals(-1, p.getY(), TOLERANCE);
assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE);
assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE);
}
@Test public void testOf2()
{
Point p = Point.ofPolar(Math.sqrt(2), -Math.PI / 4);
assertEquals(1, p.getX(), TOLERANCE);
assertEquals(-1, p.getY(), TOLERANCE);
assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE);
assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE);
}
}
Solution
Point.java
public class Point
{
int x,y;
double m,n;
public Point(){}
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); }
public static Point of(int i,int j)
{
Point p=new Point();
p.x=i;
p.y=j;
return p;
}
public static Point ofPolar(double i,double j)
{
Point p=new Point();
p.m=i;
p.n=j;
return p;
}
}
PointTest.java
import org.junit.*;
import static org.junit.Assert.*;
public class PointTest
{
private static final double TOLERANCE = 1E-12;
@Test public void testOf1()
{
Point p = Point.of(1, -1);
assertEquals(1, p.getX(), TOLERANCE);
assertEquals(-1, p.getY(), TOLERANCE);
assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE);
assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE);
}
@Test public void testOf2()
{
Point p = Point.ofPolar(Math.sqrt(2), -Math.PI / 4);
assertEquals(1, p.getX(), TOLERANCE);
assertEquals(-1, p.getY(), TOLERANCE);
assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE);
assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE);
}
}

More Related Content

Similar to Point.javapublic class Point {    int x,y;    double m,n; .pdf

namespace ConsoleApplication15 { class Program { static void Main(stri.docx
namespace ConsoleApplication15 { class Program { static void Main(stri.docxnamespace ConsoleApplication15 { class Program { static void Main(stri.docx
namespace ConsoleApplication15 { class Program { static void Main(stri.docxmaximapikvu8
 
import java-util--- public class MyLinkedList{ public static void.pdf
import java-util---  public class MyLinkedList{    public static void.pdfimport java-util---  public class MyLinkedList{    public static void.pdf
import java-util--- public class MyLinkedList{ public static void.pdfasarudheen07
 
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query ExpressionsMonadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query ExpressionsChris Eargle
 
import java.util.Scanner;public class Factorial { method usi.pdf
import java.util.Scanner;public class Factorial { method usi.pdfimport java.util.Scanner;public class Factorial { method usi.pdf
import java.util.Scanner;public class Factorial { method usi.pdfaptind
 
SOURCE CODEimport java.util.Iterator;public class CircularLinke.pdf
SOURCE CODEimport java.util.Iterator;public class CircularLinke.pdfSOURCE CODEimport java.util.Iterator;public class CircularLinke.pdf
SOURCE CODEimport java.util.Iterator;public class CircularLinke.pdfarccreation001
 
Kotlin Perfomance on Android / Александр Смирнов (Splyt)
Kotlin Perfomance on Android / Александр Смирнов (Splyt)Kotlin Perfomance on Android / Александр Смирнов (Splyt)
Kotlin Perfomance on Android / Александр Смирнов (Splyt)Ontico
 
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.pdfakaluza07
 
output and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdfoutput and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdfaccess2future1
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfshaktisinhgandhinaga
 
can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfsales88
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
Pragmatic metaprogramming
Pragmatic metaprogrammingPragmatic metaprogramming
Pragmatic metaprogrammingMårten Rånge
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfarjuntelecom26
 
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...tdc-globalcode
 
2 m2.w2.d1 - oop
2   m2.w2.d1 - oop2   m2.w2.d1 - oop
2 m2.w2.d1 - oopJustin Chen
 
Create a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdfCreate a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdfmohamednihalshahru
 
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfimport java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfStewart29UReesa
 

Similar to Point.javapublic class Point {    int x,y;    double m,n; .pdf (20)

namespace ConsoleApplication15 { class Program { static void Main(stri.docx
namespace ConsoleApplication15 { class Program { static void Main(stri.docxnamespace ConsoleApplication15 { class Program { static void Main(stri.docx
namespace ConsoleApplication15 { class Program { static void Main(stri.docx
 
import java-util--- public class MyLinkedList{ public static void.pdf
import java-util---  public class MyLinkedList{    public static void.pdfimport java-util---  public class MyLinkedList{    public static void.pdf
import java-util--- public class MyLinkedList{ public static void.pdf
 
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query ExpressionsMonadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query Expressions
 
import java.util.Scanner;public class Factorial { method usi.pdf
import java.util.Scanner;public class Factorial { method usi.pdfimport java.util.Scanner;public class Factorial { method usi.pdf
import java.util.Scanner;public class Factorial { method usi.pdf
 
SOURCE CODEimport java.util.Iterator;public class CircularLinke.pdf
SOURCE CODEimport java.util.Iterator;public class CircularLinke.pdfSOURCE CODEimport java.util.Iterator;public class CircularLinke.pdf
SOURCE CODEimport java.util.Iterator;public class CircularLinke.pdf
 
Kotlin Perfomance on Android / Александр Смирнов (Splyt)
Kotlin Perfomance on Android / Александр Смирнов (Splyt)Kotlin Perfomance on Android / Александр Смирнов (Splyt)
Kotlin Perfomance on Android / Александр Смирнов (Splyt)
 
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
 
Awt
AwtAwt
Awt
 
Applications
ApplicationsApplications
Applications
 
output and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdfoutput and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdf
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
 
can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdf
 
New C# features
New C# featuresNew C# features
New C# features
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
Pragmatic metaprogramming
Pragmatic metaprogrammingPragmatic metaprogramming
Pragmatic metaprogramming
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdf
 
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
 
2 m2.w2.d1 - oop
2   m2.w2.d1 - oop2   m2.w2.d1 - oop
2 m2.w2.d1 - oop
 
Create a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdfCreate a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdf
 
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfimport java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
 

More from anokhilalmobile

option E .Na2co3 hydrolysyes and gives NaoH which.pdf
                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf
option E .Na2co3 hydrolysyes and gives NaoH which.pdfanokhilalmobile
 
non polar molecules such as lipids and cholestrol.pdf
                     non polar molecules such as lipids and cholestrol.pdf                     non polar molecules such as lipids and cholestrol.pdf
non polar molecules such as lipids and cholestrol.pdfanokhilalmobile
 
moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
moles = molarity x volume = 4.25 molL x 2.50 L =.pdfanokhilalmobile
 
Londondispersionvan der Waals forces - these ar.pdf
                     Londondispersionvan der Waals forces - these ar.pdf                     Londondispersionvan der Waals forces - these ar.pdf
Londondispersionvan der Waals forces - these ar.pdfanokhilalmobile
 
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdfanokhilalmobile
 
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdfYou ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdfanokhilalmobile
 
why would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdfwhy would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdfanokhilalmobile
 
when the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdfwhen the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdfanokhilalmobile
 
Using mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdfUsing mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdfanokhilalmobile
 
The process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdfThe process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdfanokhilalmobile
 
The FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdfThe FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdfanokhilalmobile
 
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdfThe answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdfanokhilalmobile
 
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdfSpontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdfanokhilalmobile
 
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdfSales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdfanokhilalmobile
 
D) Counterclockwise answer .pdf
                     D) Counterclockwise answer                       .pdf                     D) Counterclockwise answer                       .pdf
D) Counterclockwise answer .pdfanokhilalmobile
 
Please give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdfPlease give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdfanokhilalmobile
 
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdfpKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdfanokhilalmobile
 
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdfnaphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdfanokhilalmobile
 
Ken is employing Correlational research methodSolutionKen is e.pdf
Ken is employing Correlational research methodSolutionKen is e.pdfKen is employing Correlational research methodSolutionKen is e.pdf
Ken is employing Correlational research methodSolutionKen is e.pdfanokhilalmobile
 

More from anokhilalmobile (20)

option E .Na2co3 hydrolysyes and gives NaoH which.pdf
                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf
option E .Na2co3 hydrolysyes and gives NaoH which.pdf
 
non polar molecules such as lipids and cholestrol.pdf
                     non polar molecules such as lipids and cholestrol.pdf                     non polar molecules such as lipids and cholestrol.pdf
non polar molecules such as lipids and cholestrol.pdf
 
moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
 
Londondispersionvan der Waals forces - these ar.pdf
                     Londondispersionvan der Waals forces - these ar.pdf                     Londondispersionvan der Waals forces - these ar.pdf
Londondispersionvan der Waals forces - these ar.pdf
 
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
 
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdfYou ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
 
why would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdfwhy would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdf
 
when the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdfwhen the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdf
 
Using mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdfUsing mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdf
 
The process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdfThe process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdf
 
The FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdfThe FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdf
 
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdfThe answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
 
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdfSpontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdf
 
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdfSales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdf
 
D) Counterclockwise answer .pdf
                     D) Counterclockwise answer                       .pdf                     D) Counterclockwise answer                       .pdf
D) Counterclockwise answer .pdf
 
Please give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdfPlease give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdf
 
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdfpKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
 
Covalent bonds .pdf
                     Covalent bonds                                   .pdf                     Covalent bonds                                   .pdf
Covalent bonds .pdf
 
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdfnaphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
 
Ken is employing Correlational research methodSolutionKen is e.pdf
Ken is employing Correlational research methodSolutionKen is e.pdfKen is employing Correlational research methodSolutionKen is e.pdf
Ken is employing Correlational research methodSolutionKen is e.pdf
 

Recently uploaded

diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 

Recently uploaded (20)

diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 

Point.javapublic class Point {    int x,y;    double m,n; .pdf

  • 1. Point.java public class Point { int x,y; double m,n; public Point(){} 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); } public static Point of(int i,int j) { Point p=new Point(); p.x=i; p.y=j; return p; } public static Point ofPolar(double i,double j) { Point p=new Point(); p.m=i; p.n=j; return p; } } PointTest.java import org.junit.*; import static org.junit.Assert.*; public class PointTest { private static final double TOLERANCE = 1E-12; @Test public void testOf1() { Point p = Point.of(1, -1);
  • 2. assertEquals(1, p.getX(), TOLERANCE); assertEquals(-1, p.getY(), TOLERANCE); assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE); assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE); } @Test public void testOf2() { Point p = Point.ofPolar(Math.sqrt(2), -Math.PI / 4); assertEquals(1, p.getX(), TOLERANCE); assertEquals(-1, p.getY(), TOLERANCE); assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE); assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE); } } Solution Point.java public class Point { int x,y; double m,n; public Point(){} 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); } public static Point of(int i,int j) { Point p=new Point(); p.x=i; p.y=j; return p; } public static Point ofPolar(double i,double j) {
  • 3. Point p=new Point(); p.m=i; p.n=j; return p; } } PointTest.java import org.junit.*; import static org.junit.Assert.*; public class PointTest { private static final double TOLERANCE = 1E-12; @Test public void testOf1() { Point p = Point.of(1, -1); assertEquals(1, p.getX(), TOLERANCE); assertEquals(-1, p.getY(), TOLERANCE); assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE); assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE); } @Test public void testOf2() { Point p = Point.ofPolar(Math.sqrt(2), -Math.PI / 4); assertEquals(1, p.getX(), TOLERANCE); assertEquals(-1, p.getY(), TOLERANCE); assertEquals(Math.sqrt(2), p.getRadius(), TOLERANCE); assertEquals(-Math.PI / 4, p.getAngle(), TOLERANCE); } }