Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With this class activity, we aim to review some object - orientation concepts based on the knowledge you have acquired in COMP 1 5 5

With this class activity, we aim to review some object-orientation concepts based on the knowledge you have acquired in COMP 155- Object-Oriented Programming. You will find a grading scheme at the end of this document - to guide you on instructor's expectations while preparing your submission.
Problem Definitions
Implementation of Design Options: This problem is adapted from Section 2.9 of our required text (starting on page 57). Assuming you are a software analyst on a project that requires extensive (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 vice-versa. In its Cartesian state, you will be storing the 'x' and 'y' coordinates of the point while you will be storing its distance from a reference point (r) and theta - an angle from the reference direction () in its Polar state.
r=x2+y22,
=tan-1(yx),
x=r*cos,
y=r*sin
1
COMP 370: Class Activity 1- Implementing Design Options
Equations (1)-(4) show expressions for converting between attributes of Polar (i.e.,'r' and '') and its counterpart - Cartesian (i.e.,'x' and 'y') 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.
Table 1: Alternative designs for PointCP class
\table[[Design,\table[[How Cartesian coor-],[dinates are computed]],\table[[How Polar coordi-],[nates are computed]]],[\table[[Design 2(D2) : Store polar coor-],[dinates only (i.e., create proper-],[ties for polar coordinates)]],\table[[Computed on demand,],[but not stored (with cor-],[responding methods).]],\table[[Simply returned (with],[corresponding methods).]]],[\table[[Design 3(D3) : Store Cartesian],[coordinates only]],\table[[Simply returned (with],[corresponding methods).]],\table[[Computed on demand,],[but not stored (with cor-],[responding methods).]]],[\table[[Design 5(D5): Abstract super-],[class with designs 2 and 3 as sub-],[classes.]],\table[[Depends on the concrete],[class used.]],\table[[Depends on the concrete],[class used.]]]]
You are required to do the following:
Modify the original implementation of PointCP.java to reflect Design 5 in Table 1. In particular, you will end up with implementations of (D5,D52,D53). You are allowed to modify implementations of methods: getDistance(...) and rotatePoint(...) as you deem fit to ensure consistency with other implementations. You are to hand-in a working code for each of the implementations that you have written.
Grading Scheme
The following scheme will be used to grade your submission. Therefore, you may also use it as a guide in preparing your deliverable.
\table[[Grade Item,Weight],[\table[[Modifications to PointCP.java],[Every working and correct implementation of a design. (15 points)],[(make sure you implement the interface given in PointCP and name]],45]]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago