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, 21.06.2019 20:50
What does operator overloading allow you to do?
Answers: 2
question
Computers and Technology, 22.06.2019 17:20
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
question
Computers and Technology, 22.06.2019 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
How to launch an app: steps to be successful? launching an app is a great idea, but it’s not that easy as we supposed to think. the majority of mobile applications don’t generate revenue because companies aren’t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
You know the right answer?
Design a Geometry class with the following methods: A static method that accepts the radius of a cir...
Questions
question
Mathematics, 01.12.2020 21:30
question
History, 01.12.2020 21:30
question
Mathematics, 01.12.2020 21:30
question
Mathematics, 01.12.2020 21:30
Questions on the website: 13722361