Points - radius(num1,num2,num3,num4)); double r =

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import static java.lang.Math.*; import javax.swing.JOptionPane; public class Points { public static void main(String[]args) { String number1 = JOptionPane.showInputDialog("Enter the first number"); double num1 = Double.parseDouble(number1); String number2 = JOptionPane.showInputDialog("Enter the second number"); double num2 = Double.parseDouble(number2); String number3 = JOptionPane.showInputDialog("Enter the third number"); double num3 = Double.parseDouble(number3); String number4 = JOptionPane.showInputDialog("Enter the fourth number"); double num4 = Double.parseDouble(number4); JOptionPane.showMessageDialog(null," The distance is = " + sqrt(distance(num1,num2,num3,num4))); JOptionPane.showMessageDialog(null," The radius is = " +
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: radius(num1,num2,num3,num4)); double r = radius(num1,num2,num3,num4); JOptionPane.showMessageDialog(null," The circumference is = " + circumference(r)); J JOptionPane.showMessageDialog(null," The area is = " + area(r)); } public static double distance(double n1, double n2, double n3, double n4) { double points = (n2-n1)*(n2-n1)+(n4-n3)*(n4-n3); return points; } public static double radius(double n1, double n2, double n3, double n4) { double r = distance(n1,n2,n3,n4); return r; } public static double circumference(double r1) { double c = r1*3.1416*2; return c; } public static double area(double r1) { double a = 3.1416*r1*r1; return a; }}...
View Full Document

Ask a homework question - tutors are online