首页 > 其他 > 详细

第二章作业.

时间:2017-09-17 19:28:45      阅读:270      评论:0      收藏:0      [点我收藏+]

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

  }
}

 

第二章作业.

原文:http://www.cnblogs.com/gaojie77/p/7536687.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!