Question: Java HELPPP.. I need someone to show me what this should look like. Its basically to help me understand the benefits of OOP programming, And

Java HELPPP.. I need someone to show me what this should look like. Its basically to help me understand the benefits of OOP programming, And i need to follow these guidlines to make a private/final class for a few classes .. PLEASE HELP loll

THE POINT.java and test cases are at the bottom... Ill literally pay someone lol

Java HELPPP.. I need someone to show me what this should looklike. Its basically to help me understand the benefits of OOP programming,And i need to follow these guidlines to make a private/final class

[Point.java]

public class Point {

 //Coordinates that are needed private final double x; private final double y; //[Constructor] public Point(double x, double y) { this.x = x; this.y = y; } //This is our Getters public double getX() { return x; } public double getY() { return y; } //First Method - to find Radius public double getRadius(){ double a = this.getX(); double b = this.getY(); return Math.sqrt(a*a + b*b); } //Second Method - Find angle public double getAngle() { return Math.atan(this.y/this.x) * 180 / Math.PI; } //Third Method - find point 90 degree from point public Point rotate90(){ //these formulas are used to calculate X and Y coordinates of new point double newX = (this.getX())*Math.cos(90) - (this.getY())*Math.sin(90); double newY = (this.getX())*Math.sin(90) + (this.getY())*Math.cos(90); return new Point(newX, newY); } } 

[PartOneTest file]

import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; public class PartOneTestCases { public static final double DELTA = 0.00001; @Test public void testCircleImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "getCenter", "getRadius"); final List expectedMethodReturns = Arrays.asList( Point.class, double.class); final List expectedMethodParameters = Arrays.asList( new Class[0], new Class[0]); verifyImplSpecifics(Circle.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } @Test public void testRectangleImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "getTopLeft", "getBottomRight"); final List expectedMethodReturns = Arrays.asList( Point.class, Point.class); final List expectedMethodParameters = Arrays.asList( new Class[0], new Class[0]); verifyImplSpecifics(Rectangle.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } @Test public void testPolygonImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "getPoints"); final List expectedMethodReturns = Arrays.asList( List.class); final List expectedMethodParameters = Arrays.asList( new Class[][] {new Class[0]}); verifyImplSpecifics(Polygon.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } @Test public void testUtilImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "perimeter", "perimeter", "perimeter"); final List expectedMethodReturns = Arrays.asList( double.class, double.class, double.class); final List expectedMethodParameters = Arrays.asList( new Class[] {Circle.class}, new Class[] {Polygon.class}, new Class[] {Rectangle.class}); verifyImplSpecifics(Util.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } private static void verifyImplSpecifics( final Class clazz, final List expectedMethodNames, final List expectedMethodReturns, final List expectedMethodParameters) throws NoSuchMethodException { assertEquals("Unexpected number of public fields", 0, Point.class.getFields().length); final List publicMethods = Arrays.stream( clazz.getDeclaredMethods()) .filter(m -> Modifier.isPublic(m.getModifiers())) .collect(Collectors.toList()); assertEquals("Unexpected number of public methods", expectedMethodNames.size(), publicMethods.size()); assertTrue("Invalid test configuration", expectedMethodNames.size() == expectedMethodReturns.size()); assertTrue("Invalid test configuration", expectedMethodNames.size() == expectedMethodParameters.size()); for (int i = 0; i  

[PartTwoTestFile]

import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; public class PartTwoTestCases { public static final double DELTA = 0.00001; @Test public void testCircleImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "getCenter", "getRadius", "perimeter"); final List expectedMethodReturns = Arrays.asList( Point.class, double.class, double.class); final List expectedMethodParameters = Arrays.asList( new Class[0], new Class[0], new Class[0]); verifyImplSpecifics(Circle.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } @Test public void testRectangleImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "getTopLeft", "getBottomRight", "perimeter"); final List expectedMethodReturns = Arrays.asList( Point.class, Point.class, double.class); final List expectedMethodParameters = Arrays.asList( new Class[0], new Class[0], new Class[0]); verifyImplSpecifics(Rectangle.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } @Test public void testPolygonImplSpecifics() throws NoSuchMethodException { final List expectedMethodNames = Arrays.asList( "getPoints", "perimeter"); final List expectedMethodReturns = Arrays.asList( List.class, double.class); final List expectedMethodParameters = Arrays.asList( new Class[0], new Class[0]); verifyImplSpecifics(Polygon.class, expectedMethodNames, expectedMethodReturns, expectedMethodParameters); } private static void verifyImplSpecifics( final Class> clazz, final List expectedMethodNames, final List expectedMethodReturns, final List expectedMethodParameters) throws NoSuchMethodException { assertEquals("Unexpected number of public fields", 0, Point.class.getFields().length); final List publicMethods = Arrays.stream( clazz.getDeclaredMethods()) .filter(m -> Modifier.isPublic(m.getModifiers())) .collect(Collectors.toList()); assertEquals("Unexpected number of public methods", expectedMethodNames.size(), publicMethods.size()); assertTrue("Invalid test configuration", expectedMethodNames.size() == expectedMethodReturns.size()); assertTrue("Invalid test configuration", expectedMethodNames.size() == expectedMethodParameters.size()); for (int i = 0; i   1/22/2018 Lab 2, CSC/CPE 203 - static methods v. instance methods Orientation This lab explores writing static methods versus instance methods in Java. Both are useful ways to get something done (a computation), but as we develop more complex code, there are lots of reasons to strongly associate a computation with a specific instance of an object (associate data and computation together in one object) Objectives To be able to write static methods that can compute the perimeter of three different types of geometric shapes (Circle, Rectangle and Polygon part 1) .To be able to write instance methods to compute the perimeter of three different types of geometric shapes (part 2) To be able to write a static method to compare the perimeters of different objects (part 1 & 2) To be able to write your own test cases to create geometric shapes and test the computation of their perimeter, and the computation of comparison of their sizes (measured as perimeter) (part 1 & 2) Resources Same as the last two labs You can get the base code her Part 1: Classes and Overloaded Methods In the provided part1 subdirectory, implement the following classes with these general requirements .Each instance variable must be private and final Provide the appropriate "accessorl"getter" methods for the instance variables. (see PartOneTestCases.java for names) . You may add methods beyond those required, but any such additional method must be private. Automaton Warning: You are an intelligent person; you should not just mechanically apply these rules only to satisfy a style checker in order to complete the lab. Instead, consider the reasons for these rules, what violating them exposes to the user/client of the corresponding class, and what following them guarantees to you, the implementer. If you aren't sure, ask your neighbor, they might have thoughts of their own Classes 1/3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!