第二章作业.
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第二章作业.相关的知识,希望对你有一定的参考价值。
2.6
import java.until.Scanner;
public class ComputeArea{
public static void main(String[] args){
Scanner input =new Scanner(System.in);
System.out.print("Enter a number between 0 and 1000: ");
double digits =input.nextDouble();
double sun =digits+digits+digits+digits;
System.out.println("the sun of the digits " + digits +"is" +sun);
}
}
2.15
import java.until.Scanner;
public class ComputeDistance{
public static void main(String[] args){
Scanner input =new Scanner(System.in);
System.out.print("Enter x1 and y1 : ");
System.out.print("Enter x2 and y2: ");
double point =input.nextDouble();
double number =(x2-x1)(x2-x1)+(y2-y1)(y2-y1);
double distance =Math.pow(number,0.5);
System.out.println("the distance between the two points " + points+"is" +distance);
}
}
以上是关于第二章作业.的主要内容,如果未能解决你的问题,请参考以下文章