Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the requirements code please make sure you dont forget about the interface class comparable the Shape interface must extended from the comparable please

image text in transcribedimage text in transcribed

This is the requirements code please make sure you dont forget about the interface class comparable the Shape interface must extended from the comparable please read the instructions carefully.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Please using these given code for the requirements and make sure the sanity check are perfectly matched. We have the given point.java, shape.java do not need to modify and you need to use the shape.java for the sanity check when everything complete. The shapes.txt and shapes_output need to be exactly the same

Link to the given java pages

Point.java

http://18.224.94.128/course/pages/java_2/assets/assignment02/Point.java?date=gFaKoBfHhp

Shape.java

http://18.224.94.128/course/pages/java_2/assets/assignment02/Shape.java?date=X31hCtGg5q

ShapeMain.java

http://18.224.94.128/course/pages/java_2/assets/assignment02/ShapeMain.java?date=ehZDd0ssM1

The output in the text file

Shapes.txt

http://18.224.94.128/course/pages/java_2/assets/assignment02/shapes.txt?date=XntPSB6M0m

Shapes_output.txt

http://18.224.94.128/course/pages/java_2/assets/assignment02/shapes_output.txt?date=5e0rkEV9Fc

Please make sure to use the given code pages and use them to compile the exactly output like the shapes.txt and the shapes_output.txt.

image text in transcribed

Please help me to make them all passed. You can check your code in this link please make sure theres no errors.

http://18.224.94.128/course/index.php?contest=49&pass=3329&submission=20230118_221219_277467241

Assignment \#2 - Shapes Background: In geometry, a shape can be defined as the form of an object or its outline, outer boundary or outer surface. Everything we see in the world around us has a shape. We can find different basic shapes such as the two-dimensional square, rectangle, and oval or the threedimensional rectangular prism, cylinder, and sphere in the objects we see around us. These geometric shapes appear in objects we see as credit cards, bills and coins, finger rings, photo frames, dart boards, huts, windows, magician's wands, tall buildings, flower pots, toy trains, and balloons. Shapes can be classified into open and closed shapes. Closed geometric shapes can further be put into two broad categories, namely two-dimensional and three-dimensional shapes. The color, overall size, and orientation called the nondefining attributes of a two-dimensional or three-dimensional shape do not define or affect the shape in any way. These attributes can change without any effect on the shape. On the other hand, defining attributes such as the number of sides (parallel or non-parallel, straight or curved), vertices, edges, and faces of a shape, whether the shape is open or closed, and the angle measures determine the shape of a two-dimensional or three-dimensional object. Any change in these defining attributes will change the shape. This assignment will assess your mastery of the following objectives: - To design interface, abstract class, and concrete classes. - To design condition for the comparable class. Rules and Explanations: In this assignment, we only focus on 2D shapes. Create an interface named Shape with prototypes: (The Shape interface must be extended from another interface Comparable) Create an abstract class named AbstractShape that implements the interface Shape. The only method that we need to implement in this class is to compare two Shape objects. The method signature must be public int compareTo(Shape other). The method will determine conditions as follow: 1. Area 2. Perimeter 3. Type of shape CS 211 3. Type of shape For example, if a square has the area 4.0 and the rectangle has the area 8.0 then the square should go before the rectangle. For another example, if a square and a rectangle have the same area and perimeter, the rectangle should go before the square because when we compare the name, rectangle starts with the letter ' r ' and square starts with the letter 's', so the letter ' r ' goes before 's'. String class also provides compareTo method, so we can rely on the result of this one. For each concrete class below, we should have one constructor that has noparameter passed in and one constructor that allows user to accept all values from parameters and assign them to the attributes of the class. All attributes should be accessed by only inside their own class (We can assume that the point inputs will form valid shapes) 1. Create a concrete class named Triangle with three attributes point1, point 2 , and point3. Those three points will form a triangle. Please use Heron's formula for calculating the area. The data type of those points will be the provided Point class. The class Triangle should extend the abstract class AbstractShape. The toString 0 method should follow the format: \{Type-Triangle, Point1-[Point X=0,Y=0], Point2 =[ Point X=0,Y=0], Point 3=[ Point X=0,Y=0]} 2. Create a concrete class named Rectangle with two attributes topLeft and bottomRight. Those two points will form a rectangle. The data type of those points will be the provided Point class. The class Rectangle should extend the abstract class AbstractShape. The toString 0 method should follow the format: \{Type=Rectangle, Topleft=[Point X=0, Y=0], BottomRight=[Point X=0,Y=0]} Not Secure - 18.224.94.128 3. Create a concrete class named Square with no attribute because it will use attributes from the class Rectangle which it inherited from. In the constructor that accepts no parameter, use only one statement to initiate the attributes of the Square class (super keyword). The second constructor accept the top left point and the length of the side (int primitive data type). Based on those two parameters, create the bottom right point and call the corresponding constructor in the super class that passes in the top left and bottom right points. The toString0 method should follow the format: \{Type-Square, TopLeft=[Point X=0,Y=0], BottomRight= [Point X=0,Y=0] \} 4. Create a concrete class named Circle with one attribute center (Point class) and radius (int primitive data type). The class Circle should extend the abstract class AbstractShape. The toString 0 method should follow the format: \{TYpe-Circle, Center-[Point X=0,Y=0 ], Radius =0} In this assignment, there is a test file provided for sanity check called ShapeMain.java Extra Credit: (N/A) Extra credit is only considered if the assignment submit (and complete) on-time according to original due date on syllabus. The due date is extended will not count. Implementation Guidelines: The program does not compile will receive grade of zero. Place your code in a class named AbstractShape, Triangle, Rectangle, Square, and Circle. - The instructions include: 5. Create a concrete class Circle that only extends the abstract class AbstractShape then implement required methods. - Be sure your code follows the naming and coding conventions for the class: 1. Instance fields of a class should be named starting with 'my' 2. Parameters to methods should be named starting with 'the' 3. Parameters to methods should be specified as final 4. Javadoc comments should be used for the class as well as the methods of the class 5. You will lose points for each of these things on every assignment if you do not adhere to the rules. 6. See this document for specifics (as well as an - Point.java (do not modify the content of this file) - Shape.java (do not modify the content of this file) - ShapeMain.java (only use this file for sanity check when everything is complete) - shapes.txt (the input test file for ShapeMain.java) - shapes_output.txt (the output test file for ShapeMain.java) - readme.txt (example) Submission: Submit to Canvas a zip file named assignment02_LASTNAME_FIRSTNAME.zip (all lower cases) that contains the following files: (assignment02_hoang_varik.zip for example) - Here is a list of files that you need to submit: 1. AbstractShape.java 2. Triangle.java 3. Rectangle.java 4. Square.java 5. Circle.java - A readme.txt file that contains the following information 1. Your name 2. An estimate of the amount of time you spent completing the assignment 3. Any problems that exist in the project (if there are not any please state so) 4. Any questions you have for Varik about the assignment Note: must pass all criterias it using LGS

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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