{"id":10492,"date":"2015-08-29T09:26:50","date_gmt":"2015-08-29T13:26:50","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10492"},"modified":"2015-08-24T10:31:30","modified_gmt":"2015-08-24T14:31:30","slug":"dropball-java-uses-a-while-loop-to-determine-how-long-it-takes-a-ball-to-fall-from-the-top-of-the-washington-monument-to-the-ground","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10492","title":{"rendered":"DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground."},"content":{"rendered":"<pre>\/** Simulating dropping a ball from the top of the Washington\r\n\u00a0*\u00a0 Monument. The program outputs the height of the ball each\r\n\u00a0*\u00a0 second until the ball hits the ground.\r\n\u00a0*\r\n\u00a0*\u00a0 Taken from Core Web Programming from\r\n\u00a0*\u00a0 Prentice Hall and Sun Microsystems Press,\r\n\u00a0*\u00a0 .\r\n\u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown;\r\n\u00a0*\u00a0 may be freely used or adapted.\r\n\u00a0*\/\r\n\r\npublic class DropBall {\r\n\u00a0 public static void main(String[] args) {\r\n\u00a0\u00a0\u00a0 int time = 0;\r\n\u00a0\u00a0\u00a0 double start = 550.0, drop = 0.0;\r\n\u00a0\u00a0\u00a0 double height = start;\r\n\u00a0\u00a0\u00a0 while (height &gt; 0) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println(\"After \" + time +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (time==1 ? \" second, \" : \" seconds,\") +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"the ball is at \" + height + \" feet.\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 time++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 drop = freeFall(time);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 height = start - drop;\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 System.out.println(\"Before \" + time + \" seconds could \" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"expire, the ball hit the ground!\");\r\n\u00a0 }\r\n\r\n\u00a0 \/** Calculate the distance in feet for an object in\r\n\u00a0\u00a0 *\u00a0 free fall.\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 public static double freeFall (float time) {\r\n\u00a0\u00a0\u00a0 \/\/ Gravitational constant is 32 feet per second squared\r\n\u00a0\u00a0\u00a0 return(16.0 * time * time); \/\/ 1\/2 gt^2\r\n\u00a0 }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/** Simulating dropping a ball from the top of the Washington \u00a0*\u00a0 Monument. The program outputs the height of the ball each \u00a0*\u00a0 second until the ball hits the ground. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems Press, \u00a0*\u00a0 . \u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown; &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10492\">Continue reading<\/a><\/p>\n","protected":false},"author":130,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1417,1424],"tags":[706,308,285],"class_list":["post-10492","post","type-post","status-publish","format-standard","hentry","category-code-programming-samples--","category-javaj2eej2me","tag-code","tag-java","tag-285","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":26950,"url":"http:\/\/bangla.sitestree.com\/?p=26950","url_meta":{"origin":10492,"position":0},"title":"DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground. #Programming Code Examples #Java\/J2EE\/J2ME #Basic Java","author":"Author-Check- Article-or-Video","date":"May 6, 2021","format":false,"excerpt":"\/** Simulating dropping a ball from the top of the Washington * Monument. The program outputs the height of the ball each * second until the ball hits the ground. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * \u00a9 2001\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10519,"url":"http:\/\/bangla.sitestree.com\/?p=10519","url_meta":{"origin":10492,"position":1},"title":"DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground","author":"","date":"August 29, 2015","format":false,"excerpt":"DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground ************************************************************ \/** Simulating dropping a ball from the top of the Washington \u00a0*\u00a0 Monument. The program outputs the height of the ball each \u00a0*\u00a0 second\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26984,"url":"http:\/\/bangla.sitestree.com\/?p=26984","url_meta":{"origin":10492,"position":2},"title":"DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground #Programming Code Examples #Java\/J2EE\/J2ME #Basic Java","author":"Author-Check- Article-or-Video","date":"May 7, 2021","format":false,"excerpt":"DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground ************************************************************ \/** Simulating dropping a ball from the top of the Washington * Monument. The program outputs the height of the ball each * second\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27215,"url":"http:\/\/bangla.sitestree.com\/?p=27215","url_meta":{"origin":10492,"position":3},"title":"BetterCircleTest.java #Programming Code Examples #Java\/J2EE\/J2ME #Advanced Swing","author":"Author-Check- Article-or-Video","date":"May 14, 2021","format":false,"excerpt":"********************** BetterCircleTest.java ********************** import java.awt.*; import java.applet.Applet; \/** Position circles down the diagonal so that their borders * just touch. Illustrates that Java 1.1 lightweight * components can be partially transparent. * *\/ public class BetterCircleTest extends Applet { public void init() { setBackground(Color.lightGray); setLayout(null); BetterCircle circle; int radius =\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26818,"url":"http:\/\/bangla.sitestree.com\/?p=26818","url_meta":{"origin":10492,"position":4},"title":"PluginApplet.jsp  Page that demonstrates the use of jsp:plugin. #Programming Code Examples #Java\/J2EE\/J2ME #JSP","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"PluginApplet.jsp Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26996,"url":"http:\/\/bangla.sitestree.com\/?p=26996","url_meta":{"origin":10492,"position":5},"title":"Position circles down the diagonal so that their borders #Programming Code Examples #Java\/J2EE\/J2ME #AWT Components","author":"Author-Check- Article-or-Video","date":"May 7, 2021","format":false,"excerpt":"import java.awt.*; import java.applet.Applet; \/** Position circles down the diagonal so that their borders * just touch. Illustrates that AWT components are * rectangular and opaque. *\/ public class CircleTest2 extends Applet { public void init() { setBackground(Color.lightGray); setLayout(null); \/\/ Turn off layout manager. Circle circle; int radius = getSize().width\/6;\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/130"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10492"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10492\/revisions"}],"predecessor-version":[{"id":10493,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10492\/revisions\/10493"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10492"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}