24 May java program
Outcomes ▪ Write programs that use objects.
▪ Write programs that use ArrayList.
▪ Write programs that use abstract classes, and interfaces.
▪ Write applications using object oriented programming concepts.
▪ Organize classes in packages.
Scoring ▪ If you do not submit a .zip file containing your source code,
your score will be zero.
▪ If you submit source code that does not compile, your score
will be zero.
▪ If you submit source code without the correct class name(s)
or the correct method names (see below), your score will be
decreased by 50 points.
▪ In addition, deductions will be made for not meeting the following
requirements:
o At the beginning of each java file, add a comment with the following
information:
▪ Student’s name
▪ Course/section,
▪ Date
▪ Filename
▪ Description of the program/class o Indentation guidelines:
▪ The code inside of a class must be indented with respect
to the class definition.
▪ The code inside of a method must be indented with respect
to the method definition.
▪ The code inside of if / else / else if / while / for
/ do-while structures must be indented with respect to its
corresponding structure.
▪ Curly braces can be positioned at the end of the corresponding
structure definition, or in the following lines aligned with the
corresponding structure. o Comments:
▪ At least, one-line comment should be added per method or
constructor.
▪ Comments must describe the functionality or objective of the
method.
▪ Please add more comments about your code, if you think
that will help the grader.
Rubric Full credit Partial credit
Implement the Person
Solution
(25 points)
You implements the Person
Solution.
You implements the
Person Solution,
but with some
errors.
Implement the Distance
Solution
( 40 points)
You implements the Distance
Solution.
You implements the
Distance Solution,
but with some
errors.
Implement the Rectangle
Solution
(35 points)
You implements the Rectangle
Solution.
You implements the
Rectangle
Solution, but with
some errors.
Description This assignment consists of the development of three solutions. Each solution should
be stored in its own folder.
DistanceSolution 1. Create a project named DistanceSolution.
2. Create a class named distance.
3. Include that class in a package named metrics.
4. Inside the class distance, create two static methods named manhattanDistance
and euclideanDistance.
5. The method manhattanDistance receives as parameters two Double array lists.
a. If the the two lists do not contain the same number of elements, this
method returns -1
b. Otherwise, the method shoud calculate the Manhattan distance between
the two vectors and return it as a double value.
c. For more information about how to calculate the Manhattan distance
between two vectors, see
https://xlinux.nist.gov/dads/HTML/manhattanDistance.html
6. The method euclideanDistance receives as parameters two Double array
lists
a. If the array lists do not contain the same number of elements, this
method returns -1
b. Otherwise, the method shoud calculate the Euclidian distance between the
two vectors and return it as a double value.
c. For more information about the Euclidean distance, see
https://xlinux.nist.gov/dads/HTML/euclidndstnc.html
7. Create a program for testing these methods. Name this program
DistanceTest.
8. In DistanceTest,
a. Create two numerical array lists of size 3. Provide double values for
these array lists.
b. Display the content of these array lists.
c. Display the Manhattan distance between these vectors (array lists) by
calling the method manhattanDistance.
d. Create other two numerical array lists of size 5. Provide double
values for these array lists.
e. Display the content of these array lists.
f. Display the Euclidian distance between these vectors (array lists) by calling
the method euclideanDistance.
Sample run == Distance Solution ==
Vector 1: [ 5.0, 6.7, 11.0]
Vector 2: [ -9.0, 8.0, 0.3]
Manhattan distance between vector 1 and vector 2: 26.00
Vector 3: [ 0.5, 6.0, -2.0, 4.12, 15.6]
Vector 4: [ -10.0, 8.6, 0.001, 9.2, 4.0]
Euclidean distance between vector 3 and vector 4: 16.77
RectangleSolution 1. Create a project named RectangleSolution.
2. The class java.awt.Rectangle does not contain a method to calculate the
area of a Rectangle object; also it does not implement the interface
Comparable.
3. Create a subclass of the Rectangle class named ComparableRectangle
which also implements the Comparable interface.
4. Include that class in a package named geometry.
5. Create a constructor which receives two parameters width and height. Use
these parameters to initialize the corresponding instance variables in the
ComparableRectangle object.
6. Create a public method named getArea which returns the area of the
ComparableRectangle object.
7. Implement the method compareTo. Remember that this method receives another
ComparableRectangle as parameter.
8. Create a program for testing this class. Name this program RectangleTest.
9. In RectangleTest,
a. Create three ComparableRectangle objects. The first and second
ComparableRectangle objects will have the same width and height.
The third ComparableRectangle will have a different witdh and
height.
b. Display the measures of these ComparableRectangle objects by using
the method toString.
c. Also, display the result obtained by comparing
i. First ComparableRectangle with second ComparableRectangle.
ii. First ComparableRectangle with third
ComparableRectangle. iii. Third ComparableRectangle with
second ComparableRectangle.
Sample run == Comparable Rectangle Solution ==
Rectangle 1: geometry.ComparableRectangle[x=0,y=0,width=5,height=8]
Rectangle 2: geometry.ComparableRectangle[x=0,y=0,width=5,height=8]
Rectangle 3: geometry.ComparableRectangle[x=0,y=0,width=11,height=2]
Compare Rectangle 1 to Rectangle 2: 0
Compare Rectangle 1 to Rectangle 3: 18
Compare Rectangle 3 to Rectangle 2: -18
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
