Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem Definitions Implementation of Design Options: This problem is adapted from Section 2 . 9 of our required text ( starting on page 5 7
Problem Definitions
Implementation of Design Options: This problem is adapted from Section of our required
text starting on page Assuming you are a software analyst on a project that requires ex
tensive in millions rotation of points and computation of the distance between any
two points and performance is key to the success of the project. However, to realize this, you are
allowed to store a point either in its Polar or Cartesian coordinates formats. For example, you may
choose to store a point in its Polar form but provide interfaces to convert or store it in its Cartesian
form and viceversa. In its Cartesian state, you will be storing the and coordinates of the
point while you will be storing its distance from a reference point and theta an angle from
the reference direction in its Polar state.
Equations show expressions for converting between attributes of Polar ie and and its counterpart Cartesian ie and coordinates. In the figure below, we provide class designs of PointCP and PointCPTest whose implementations can be downloaded from: PointCP PointCP.java and PointCPTest PointCPTest.java.
tablePointCPgetXgetYgetThetagetRhogetDistanceObject pointrotatePointdouble rotation
tablePointCPTestmain
Table : Alternative designs for PointCP class
tableDesigntableHow Cartesian coordinates are computedtableHow Polar coordinates are computedtableDesign : Store polar coordinates only ie create properties for polar coordinatestableComputed on demand,but not stored with corresponding methodstableSimply returned withcorresponding methodstableDesign : Store Cartesiancoordinates onlytableSimply returned withcorresponding methodstableComputed on demand,but not stored with corresponding methodstableDesign : Abstract superclass with designs and as subclassestableDepends on the concreteclass used.tableDepends on the concreteclass used.
You are required to do the following:
Modify the original implementation of PointCP.java to reflect Design in Table In particular, you will end up with implementations of You are allowed to modify implementations of methods: getDistance and rotatePoint as you deem fit to ensure consistency with other implementations. You are to handin a working code for each of the implementations that you have written.
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