Solved by verified expert:Java
exercise5.docx
Unformatted Attachment Preview
Surname 1
1
Define a Java class that will represent a triangle. First create the
UML class diagram for the Triangle class as described here. In
the class, declare 3 private instance variables (doubles) for the 3
sides, with default values of 1. Also, define the following public instance methods: • constructor with 3 double parameters (call the
mutator described next) • 1 public mutator (set) method for the 3
sides (so it must have 3 double parameters), but unlike the Circle
class, make sure each of the parameters is > 0 AND the sum of 2
sides > the other (i.e., make sure a+b>c and a+c>b and b+c>a),
and if so, assign a parameter to its corresponding instance variable • 3 accessor methods, one for each of the 3 sides (each will
return one double) • a method that calculates and returns the perimeter of the triangle (double) • a method that calculates and returns the area of the triangle (double) using Heron’s formula
shown in Lesson 5 (page 5.6). Before you could test this, read
Lesson 5, page 5.7 first (not required to run this for the exercise,
you will be required to in the next exercise). UPLOAD the UML
class diagram (as a Word doc or PDF or picture and the Triangle
class.
2
Write main (may be in the same or separate class from the Triangle class) to test the Triangle class that you wrote, if correct, or
the posted answer for Exercise 5.1. Instantiate at least 2 Triangle
objects, assigning them to Triangle variables in main. Call at least
2 of the instance methods for EACH of the Triangle objects, displaying the results. Run this, copy and paste the output (commented out) after the end of this program.
Surname 2
3
Write a class called Customer which has private instance variables for a name, account number and SavingsAccount (see SavingsAccount class link). Include a constructor with a String, long,
and double parameters which instantiates a SavingsAccount using the double parameter. Also include accessors for each instance variable and a mutator for the name only. You MUST also
write the UML class diagram for this class.
…
Purchase answer to see full
attachment
You will get a plagiarism-free paper and you can get an originality report upon request.
All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more