The Artima Developer Community
Sponsored Link

Java Answers Forum
Practical question

1 reply on 1 page. Most recent reply: Jul 2, 2003 7:35 PM by David

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Sello

Posts: 3
Nickname: comic123
Registered: Jul, 2003

Practical question Posted: Jul 2, 2003 12:10 AM
Reply to this message Reply
Advertisement
A standard physical experiment is to drop a ball to see how high it bounces. Once the "bounciness" of the ball is determined, the ratio gives a bounciness index. For example, if a ball dropped from a height of 10 feet bounces 6 feet high, the index is 0.6 and the total distance travelled by the ball is 16 feet after one bounce. If the ball continues bouncing, the distance after two bounces would be 10+6+3.6=25.6 ft. Note that the distance travelled for each bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up.
Write a program that takes as inputs the initial height of the ball (in feet), the index of the ball's bounciness, and the number of times the ball is allowed to continue bouncing. The program should output the total distance travelled by the ball. At some point in the process, the distance travelled by the ball after a bounce might become negligable, for example, for example, less than 0.00001 inches. If that stage is reached, terminate the process and output the total distance.


David

Posts: 18
Nickname: malven
Registered: Jul, 2003

Re: Practical question Posted: Jul 2, 2003 7:35 PM
Reply to this message Reply
No offense, but this sounds like a homework assignment. Writing a small program like this in Java would be very similar to doing it in other 3GLs.

Instead of asking other people to write the program for you from scratch, can you tell us where are you getting stuck?

Flat View: This topic has 1 reply on 1 page
Topic: How instanciate a class in the JVM ?? Previous Topic   Next Topic Topic: How do I create a JDialog whose size is Fixed

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use