}
================================================================
public class disizhang {
public static void main(String[] args){
double x1 = 35.2270869;
double y1 = -80.8431267;
double x2 = 32.0835407;
double y2 = -81.0998342;
double dcs = 6371.0*Math.acos(Math.sin(Math.toRadians(x1))*Math.sin(Math.toRadians(x2))+Math.cos(Math.toRadians(x1))*Math.cos(Math.toRadians(x2))*Math.cos(Math.toRadians(y1-y2)));
x2 = 33.7489954;
y2 = -84.3879824;
double dca = 6371.0*Math.acos(Math.sin(Math.toRadians(x1))*Math.sin(Math.toRadians(x2))+Math.cos(Math.toRadians(x1))*Math.cos(Math.toRadians(x2))*Math.cos(Math.toRadians(y1-y2)));
x1 = 28.5383355;
y1 = -81.3792365;
double doa = 6371.0*Math.acos(Math.sin(Math.toRadians(x1))*Math.sin(Math.toRadians(x2))+Math.cos(Math.toRadians(x1))*Math.cos(Math.toRadians(x2))*Math.cos(Math.toRadians(y1-y2)));
x2 = 32.0835407;
y2 = -81.0998342;
double dos = 6371.0*Math.acos(Math.sin(Math.toRadians(x1))*Math.sin(Math.toRadians(x2))+Math.cos(Math.toRadians(x1))*Math.cos(Math.toRadians(x2))*Math.cos(Math.toRadians(y1-y2)));
x1 = 33.7489954;
y1 = -84.0998342;
double das = 6371.0*Math.acos(Math.sin(Math.toRadians(x1))*Math.sin(Math.toRadians(x2))+Math.cos(Math.toRadians(x1))*Math.cos(Math.toRadians(x2))*Math.cos(Math.toRadians(y1-y2)));
double s1 = (dca+dcs+das)/2;
double s2 = (doa+dos+das)/2;
double a = Math.sqrt(s1*(s1-dca)(s1-dcs)(s1-das))+Math.sqrt(s2*(s2-doa)(s2-dos)(s2-das));
System.out.println(“The area is “+a+” km^2”);
}
}
================================================================
import java.util.Scanner;
public class disizhang {
public static void main(String[] args){
final double PI = 3.141592654;
Scanner input = new Scanner(System.in);
System.out.print("Enter the side: ");
double s = input.nextDouble();
double a = 6ss/(4*Math.tan(PI/6));
System.out.println("The area of the hexagon is "+a);
}
}
================================================================
import java.util.Scanner;
public class disizhang {
public static void main(String[] args){
final double PI = 3.141592654;
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of sides: ");
int n = input.nextInt();
System.out.print("Enter the side: ");
double s = input.nextDouble();
double a = nss/(4*Math.tan(PI/n));
System.out.println("The area of the polygon is "+a);
}
}
================================================================
public class disizhang {
public static void main(String[] args){
final double PI = 3.141592654;
double alpha1 = Math.random()2PI;
double alpha2 = Math.random()2PI;
double alpha3 = Math.random()2PI;
double x1 = 40*Math.cos(alpha1);
double y1 = 40*Math.sin(alpha1);
double x2 = 40*Math.cos(alpha2);
double y2 = 40*Math.sin(alpha2);
double x3 = 40*Math.cos(alpha3);
double y3 = 40*Math.sin(alpha3);
double a = Math.sqrt((x1-x2)(x1-x2)+(y1-y2)(y1-y2));
double b = Math.sqrt((x2-x3)(x2-x3)+(y2-y3)(y2-y3));
double c = Math.sqrt((x1-x3)(x1-x3)+(y1-y3)(y1-y3));
double aa = Math.toDegrees(Math.acos((aa-bb-cc)/(-2b*c)));
double ab = Math.toDegrees(Math.acos((bb-aa-cc)/(-2a*c)));
double ac = Math.toDegrees(Math.acos((cc-bb-aa)/(-2a*b)));
System.out.println("The three angles are: “+aa+” “+ab+” "+ac);
}
}
================================================================
import java.util.Scanner;
public class disizhang {
public static void main(String[] args){
final double PI = 3.141592654;
Scanner input = new Scanner(System.in);
System.out.print("Enter the radius of the bounding circle: ");
double r = input.nextDouble();
double base = 0.1*PI;
System.out.println(“The coordinates of fibe points on the pentagon are”);
for(int i=0;i<5;i++)
{
System.out.printf(“(%.2f, %.2f)%n”,rMath.cos(base),rMath.sin(base));
base+=0.4*PI;
}
}
}
================================================================
import java.util.Scanner;
public class disizhang {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Ent6er an ASCII code: ");
int num = input.nextInt();
char str = (char)num;
System.out.printf(“The character for ASCII code %d is %c”,num,str);
}
}
================================================================
import java.util.Scanner;
public class disizhang {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter a character: ");
String jb = input.nextLine();
char str = jb.charAt(0);
int str2 = (int)str;
System.out.printf(“The Unicode for the character %c is %d”,str,str2);
}
}
=================================================================
public class disizhang {
public static void main(String[] args)
{
//在原来代码中进行修改
int answer = input.nextInt()修改为:char answer = input.nextLine().charAt(0)
if(answer1)—>if(answer’Y’)
}
}
=================================================================
import java.util.Scanner;
public class disizhang {
public static void main(String[] args){
System.out.print("Enter a decimal value (0 to 15): ");
Scanner input = new Scanner(System.in);
int num = input.nextInt();
if(num>=0&&num<=15){
if(num<10)
System.out.printf(“The hex value is %d”,num);
else
System.out.printf(“The hex value is %c”,‘A’+num-10);
}else
System.out.printf(“%d is an invalid input”,num);
}