"Written test" 10, a ball from the height of 100 meters free fall, to find relevant data

Source: Internet
Author: User

Tag:java    the ball from 100 meters height free fall    

/** * Title: A ball from 100 meters height of the free fall, each landing back to the original height of half, and then down, to ask it to fall on the 10th time, the total number of meters?  How high is the 10th time rebound? * Time: July 28, 2015 15:34:18 * file: Lianxi10.java * cutter_point */package bishi.zuixin50.t2015728;public class Lianxi10 {// This is a geometric series public static double Getan (double begin, double n) {//The height of the rebound when the nth landing is obtained, that is, the height of the 11th time//similar to geometric series a:n = a:1/POW (2, n-1) dou Ble pow = math.pow (2.0, n); return begin/pow;} Calculate the distance/** * Geometric series sum * @param begin the place where the ball begins to fall * @param q We ratio * @param n number * @return */public static double GetLength (do Uble begin, double Q, double n) {//our formula is S:n = (a:1 * (1-q (n-th)))/(1-Q)//The formula here is S:n = 0.5 * s:n-1 + 150== "s:n =-((10 0)/pow (2, n-2)) + 300//This song sn is: (3*n + 1/(2: (n-2))-4) Double length = begin * (3-MATH.POW (q, N-2)); return length;} public static void Main (string[] args) {System.out.println ("the height of the 10th bounce is:" + getan (100, 10)); System.out.println ("The Distance traveled is:" + getlength (1, 0.5, ten));d ouble h = 100,s = 100;for (int i = +; I < ++i) {s + = H;h/= 2;} System.out.println ("After the journey:" + s); System.out.println ("Bounce Height:"+ H/2);}} 

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Written test" 10, a ball from the height of 100 meters free fall, to find relevant data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.