当前位置:网站首页 > Java基础 > 正文

java语言程序设计基础篇课后



System.out.printf(“The area of the pentagon is %.2f”,a);

}

}

4.2

====================java语言程序设计基础篇课后============================================

import java.util.Scanner;

public class disizhang {

public static void main(String[] args){

Scanner input = new Scanner(System.in);

System.out.print("Enter point 1 (latitude and longitude) in degrees: ");

double x1 = input.nextDouble();

double y1 = input.nextDouble();

System.out.print("Enter point 2 (latitude and longitude) in degrees: ");

double x2 = input.nextDouble();

double y2 = input.nextDouble();

double d = 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)));

System.out.println(“The distance between the two points is “+d+” km”);

}

}

4.3

================================================================

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”);

}

}

4.4

================================================================

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);

}

}

4.5

================================================================

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);

}

}

4.6

================================================================

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);

}

}

4.7

================================================================

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;

}

}

}

4.8

================================================================

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);

}

}

4.9

================================================================

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);

}

}

4.10

=================================================================

public class disizhang {

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注Java获取)

img

学习分享,共勉

这里是小编拿到的学习资源,其中包括“中高级Java开发面试高频考点题笔记300道.pdf”和“Java核心知识体系笔记.pdf”文件分享,内容丰富,囊括了JVM、锁、并发、Java反射、Spring原理、微服务、Zookeeper、数据库、数据结构等大量知识点。同时还有Java进阶学习的知识笔记脑图(内含大量学习笔记)!

资料整理不易,读者朋友可以转发分享下!

Java核心知识体系笔记.pdf

记一次蚂蚁金服Java研发岗的面试经历,分享下我的复习笔记面经

中高级Java开发面试高频考点题笔记300道.pdf

记一次蚂蚁金服Java研发岗的面试经历,分享下我的复习笔记面经

架构进阶面试专题及架构学习笔记脑图

记一次蚂蚁金服Java研发岗的面试经历,分享下我的复习笔记面经

Java架构进阶学习视频分享
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
ing原理、微服务、Zookeeper、数据库、数据结构等大量知识点。同时还有Java进阶学习的知识笔记脑图(内含大量学习笔记)!**

资料整理不易,读者朋友可以转发分享下!

Java核心知识体系笔记.pdf

[外链图片转存中…(img-5GIaEm8k-1713175955653)]

中高级Java开发面试高频考点题笔记300道.pdf

[外链图片转存中…(img-4h6nC4xW-1713175955653)]

架构进阶面试专题及架构学习笔记脑图

[外链图片转存中…(img-OVjPWLSO-1713175955653)]

版权声明


相关文章:

  • java的基础知识视频2024-10-15 18:10:02
  • java基础版项目实战2024-10-15 18:10:02
  • java基础实现聊天室2024-10-15 18:10:02
  • 零基础学java 阿拓2024-10-15 18:10:02
  • java面试数据库基础2024-10-15 18:10:02
  • java小白零基础学习视频2024-10-15 18:10:02
  • 南昌零基础学java2024-10-15 18:10:02
  • java基础易错2024-10-15 18:10:02
  • java输入输出流基础知识2024-10-15 18:10:02
  • 基础java能做出哪些软件2024-10-15 18:10:02