points of a triangle and displays the angles in degrees. Round the value to keep

two digits after the decimal point. The formula to compute angles A, B, and C are

as follows:

A = arccos((a * a - b * b - c * c) / (-2 * b * c))

B = arccos((b * b - a * a - c * c) / (-2 * a * c))

C = arccos((c * c - b * b - a * a) / (-2 * a * />/>)

Here is a sample run of the program:

Enter three points: 6.5 6.5 2.5

The three angles are 15.26 90.0 74.74

Here is my code so far: I am having trouble trying to take in three variables, pass them to the method and then return them.

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package pkg5.pkg23; /** * * @author Coxxie */ import java.util.Scanner; public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter 3 sides of a triangle: \n"); System.out.print("Enter side A of a triangle: \n"); double sideA = input.nextInt(); System.out.print("Enter side B of a triangle: \n"); double sideB = input.nextInt(); System.out.print("Enter side C of a triangle: \n"); double sideC = input.nextInt(); double anglel = angleA(sideA, sideB, sideC); double angle2 = angleB(sideA, sideB, sideC); double angle3 = angleC(sideA, sideB, sideC); System.out.println ("The three angles are: " + angleA(anglel) + " "+ angleB(angle2) + " " + angleC(angle3)); } public static double angleA(double sideA, double sideB, double sideC) { //figA = equation in book. Imput it in and copy in sides. double angA = Math.acos((sideA * sideA - sideB * sideB - sideC * sideC) / (-2 * sideB * sideC)); return angA; } public static double angleB(double sideA, double sideB, double sideC) { //figA = equation in book. Imput it in and copy in sides. double angB = Math.acos((sideA * sideA - sideB * sideB - sideC * sideC) / (-2 * sideB * sideC)); return angB; } public static double angleC(double sideA, double sideB, double sideC) { //figA = equation in book. Imput it in and copy in sides. double angC = Math.acos((sideA * sideA - sideB * sideB - sideC * sideC) / (-2 * sideB * sideC)); return angC; } }

This post has been edited by **jon.kiparsky**: 05 October 2013 - 11:15 AM

Reason for edit:: [code] tags