Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Perimeter Calculator In this assignment you will calculate the perimeter of circles and triangles based on input by the user. Your Java class will

image text in transcribedimage text in transcribed
1 Perimeter Calculator In this assignment you will calculate the perimeter of circles and triangles based on input by the user. Your Java class will be made 11p of several methods that work together to perform these tasks. 1.1 Requirements [25 points] Your program must: 1. The program should ask the user whether they want to calculate the perimeter of a Circle, a Triangle, or if they want to exit. 2. If the user selects the circle, the user should be able to enter the radius of the circle. The program should print out the perimeter of the circle, and then return to step 1 3. If the user selects the triangle, the user should be able to enter the three points (six numbers) of the triangle. The program should print out the perimeter of the triangle, and then return to step 1. 4. If the user selects the option to exit, the program should terminate. Your program must contain and use at least four methods in Perimeter.java. Some suggestions for methods are listed here: 0 Error checking: you should have a method that checks that any value entered by the user is positive (i.e., to prevent the user entering negative radii). 0 Distance between two points: write a method to calculate the distance between two points 0 Perimeter of a triangle: write a method that uses the distance between two points method to calculate the perimeter of the triangle 0 Perimeter of a circle: write a method that uses the radius to calculate perimeter of the circle 0 Void methods for printing options to the user 1.2 Design Diagram [5 points] Draw a top-down design digram to illustrate how you are breaking down your program. See Figure 6.11 or slide 21 in Lecture14) for a reminder on the structure of a top-down design digram. The final diagram must be saved in the PerimeterDesign . pdf file. If you draw the diagram in paper, then you must scan that solution to save it in the proper file type. Or you could complete the diagram online (such as Word or app . diagrams . net. 2 1.3 Sample Output Select one of the following options: 1. Triangle 2 . Circle 3 Exit Please enter X1 : 5 Please enter Y1: 5 Please enter X2: 6 Please enter Y2: 7 Please enter X3: 8 Please enter Y3: 5 The perimeter of a triangle with point (5,5) and (6,7) and (8,5) is 8.064495 Select one of the following options: Triangle 2. Circle 3. Exit 2 Please enter the radius: 10 The perimeter of a circle with radius 10 is 62.83 Select one of the following options: 1. Triangle 2 . Circle 3 . Exit 3

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

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions