码迷,mamicode.com
首页 > 其他好文 > 详细

第二章作业.

时间:2017-09-17 19:32:11      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:ann   dig   oid   can   tween   ber   bsp   distance   math   

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

  }
}

 

第二章作业.

标签:ann   dig   oid   can   tween   ber   bsp   distance   math   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!