KEEP RECEIVING WRONG ANSWERS.

JAVA ONLY PLEASE HELP POST ONLY THE CODE

8.104 Program: Area by Instructor note: While you will be submitting this assignment through Zybooks, make sure you are still

Ex: Enter the radius: 3 You entered: 3 Your circle has an area of: 28.27 (3) Implement the Rectangle option. Prompt the use

Ex Enter the first side: 3 You entered: 3 Enter the second side: 4 You entered: 4 Enter the third side: 5 You entered: 5 Your

8.104 Program: Area by Instructor note: While you will be submitting this assignment through Zybooks, make sure you are still applying appropriate formatting and in-line commenting. Download from Blackboard and debug the program GeometricArea.java that uses method overloading and the Java API in your own IDE and upload it here. There are seven (7) errors that need to be found and corrected to make the outputs match. (1) Implement a menu of options for a user to select their geometric object. Each option is represented by a single character. The program initially outputs the menu, and outputs the menu after a user chooses an option. The program ends when the user chooses the option to Quit. For this step, the other options do nothing. (1 pt) Ex: MENU Circle C- Rectangle Triangle Quit Choose an option: (2) Implement the “Circle” option. Prompt the user for the radius of the circle for the calculation. Create a method called calculateArea that takes the radius and returns the area. Use the API to find the method that allows you to perform exponential operations and to use the constant PI (Hint: java.lang.Math) (2 pt) Ex: Enter the radius: 3 You entered: 3 Your circle has an area of: 28.27 (3) Implement the ‘Rectangle’ option. Prompt the user for the length and width of the rectangle for the calculation. Overload the first method with another that takes both length and width and returns the area. (2 pt) Ex: Enter the length: 5 You entered: 5 Enter the width: 7 You entered: 7 Your rectangle has an area of: 35 (4) Implement the “Triangle’ option. Prompt the user for the three sides of the triangle for the calculation. Overload the first method with another that takes the three sides and returns the area (use Heron’s formula). Use the API to find the method that allows you to perform a square root. (2 pt) Ex: Enter the first side: 3 You entered: 3 Enter the second side: 4 You entered: 4 Enter the third side: 5 You entered: 5 Ex Enter the first side: 3 You entered: 3 Enter the second side: 4 You entered: 4 Enter the third side: 5 You entered: 5 Your triangle has an of: 6 area LAB 8.104.1: Program: Area by Overloading 0/7 ACTIVITY Submission Instructions Compile command javac GeometricArea.java -Werror We will use this command to compile your code Upload your files below by dragging and dropping into the area or choosing a file on your hard drive Drag file here Geomet….java or Choose on hard drive. Submit for grading Latest submission No missions yet



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *