Question: need help. When running program keep receiving NaN error. This is Java code public static voia nostring args) { double x1,y1, x2,42,x3, y3, angleA, angleb,

need help. When running program keep receiving NaN error. This is Javacode public static voia nostring args) { double x1,y1, x2,42,x3, y3, angleA,need help. When running program keep receiving NaN error. This is Java code

public static voia nostring args) { double x1,y1, x2,42,x3, y3, angleA, angleb, anglec, lengthA, lengths, lengthc; Scanner input = new Scanner(System.in); System.out.println("We are going to find the length of the sides and angle values of a triangle."); System.out.println("Please enter xl value for Angle A: "); x1 = input.nextDouble(); System.out.println("Please enter yi value for Angle A: "); y1 = input.nextDouble(); System.out.println("Please enter x2 value for Angle B: "); x2 = input.nextDouble(); System.out.println("Please enter y2 value for Angle B: "); y2 = input.nextDouble(); System.out.println("Please enter x3 value for Angle c: "); x3 = input.nextDouble(); System.out.println("Please enter y3 values for Angle C: "); y3 = input.nextDouble(); TE System.out.println("AC System.out.println("B( System.out.println("CC + x1 + + x2 + + x3 + + y2 + y2 + y3 + ) "); "); ") "); + 3 + lengthc (Math.sqrt(Math.pow(x1 lengthB = (Math.sqrt(Math.pow(x1 length (Math.sqrt(Math.pow(x2 X2,2.0) x3,2.0) x3,2.0) Math.pow(y1 - y2, 2.0))); + Math.pow(y1 y3, 2.0))); + Math.pow(y2 y3, 2.0))); = = angle (Math.acos((lengthA * lengthA) (lengths length) - (lengthc * lengthc)) I (2 * (lengthB * lengthc))); angles (Math.acos((lengthB * length) (lengthA * lengthA) (length( * lengthc)) I (2 * (lengthA * length())); anglec (Math.acos((length * lengthc) - (lengthB * lengthB) - (lengthA * length)) / (2 * (lengthA * length))); L System.out.println("Angle A has a value of " + angleA); System.out.println("Angle B has a value of " angleB); System.out.println("Angle C has a value of " + angle(); } + Angle A has a value of Nan Angle B has a value of NaN Angle C has a value of Nan

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!