Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A triangle ABC is inscribed in a circle, that is, the vertices of the triangle a

ID: 3626011 • Letter: A

Question

A triangle ABC is inscribed in a circle, that is, the vertices of the triangle are on the circumference of the circle. Suppose the triangle ABC divides the circumference into lengths of a, b, and c inches. Design an algorithm that asks the user to specify the values of a, b, and c and then calculates the radius of the circle. Note that if r is the radius of the circle then 2pr = a + b + c. Write a program to implement and test the algorithm that you designed.Test your program with the following values:

· a=6, b=7, c=8

· a=0.452, b=0.743, c=0.716

· a=7.5, b=8, c=3.4

Explanation / Answer

Note:- main method is only for testing and can be removed package test; import java.util.Scanner; public class RadiusCalculator { public static float pie = 3.1416f; public static void main(String[] args) { RadiusCalculator radiusCalculator = new RadiusCalculator(); System.out.println(radiusCalculator.calculateRadius(6, 7, 8)); System.out.println(radiusCalculator.calculateRadius(0.452f, 0.743f, 0.716f)); System.out.println(radiusCalculator.calculateRadius(7.5f, 8, 3.4f)); } public float getInputsAndGetRadius() { Scanner keyboard = new Scanner(System.in); System.out.println("Enter value of a"); float a = keyboard.nextFloat(); System.out.println("Enter value of b"); float b = keyboard.nextFloat(); System.out.println("Enter value of c"); float c = keyboard.nextFloat(); return this.calculateRadius(a, b, c); } public float calculateRadius(float a, float b, float c) { float circumference = a+b+c; float radius = circumference/(2*pie); return radius; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote