subject

Design a Geometry class with the following methods: A static method that accepts the radius of a circle and returns the area of the circle. Use the following formula: A r e a = π r 2 Use Math. PI for π and the radius of the circle for r. A static method that accepts the length and width of a rectangle and returns the area of the rectangle. Use the following formula: A r e a = L e n g t h × W i d t h A static method that accepts the length of a triangle’s base and the triangle’s height. The method should return the area of the triangle. Use the following formula: A r e a = B a s e × H e i g h t × 0.5 The methods should display an error message if negative values are used for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. Next, write a program to test the class, which displays the following menu and responds to the user’s selection: Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1-4): Display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
So im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in a day but dont know how can you guys 2163371293
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
question
Computers and Technology, 24.06.2019 10:20
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
question
Computers and Technology, 25.06.2019 02:30
One important thing in finding employment is to get your resume noticed and read.true or false
Answers: 2
You know the right answer?
Design a Geometry class with the following methods: A static method that accepts the radius of a cir...
Questions
Questions on the website: 13722360