{"id":10519,"date":"2015-08-29T09:43:15","date_gmt":"2015-08-29T13:43:15","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10519"},"modified":"2015-08-24T10:33:51","modified_gmt":"2015-08-24T14:33:51","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-2","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10519","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>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\r\n************************************************************\r\n\/** 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*****************************************\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++;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\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\u00a0 \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}\r\n@@@@@@@@@@@@@@@@@@@@<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 until the ball hits the &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10519\">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-10519","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":10492,"url":"http:\/\/bangla.sitestree.com\/?p=10492","url_meta":{"origin":10519,"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.","author":"","date":"August 29, 2015","format":false,"excerpt":"\/** 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\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":10519,"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 #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":26950,"url":"http:\/\/bangla.sitestree.com\/?p=26950","url_meta":{"origin":10519,"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 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":10279,"url":"http:\/\/bangla.sitestree.com\/?p=10279","url_meta":{"origin":10519,"position":3},"title":"BetterCircleTest.java","author":"","date":"August 26, 2015","format":false,"excerpt":"********************** BetterCircleTest.java ********************** import java.awt.*; import java.applet.Applet; \/** Position circles down the diagonal so that their borders \u00a0*\u00a0 just touch. Illustrates that Java 1.1 lightweight \u00a0*\u00a0 components can be partially transparent. \u00a0* \u00a0 *\/ public class BetterCircleTest extends Applet { \u00a0 public void init() { \u00a0\u00a0\u00a0 setBackground(Color.lightGray); \u00a0\u00a0\u00a0 setLayout(null); \u00a0\u00a0\u00a0\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":27215,"url":"http:\/\/bangla.sitestree.com\/?p=27215","url_meta":{"origin":10519,"position":4},"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":26791,"url":"http:\/\/bangla.sitestree.com\/?p=26791","url_meta":{"origin":10519,"position":5},"title":"Simplifies the setting of native look and feel #Programming Code Examples #Java\/J2EE\/J2ME #Layout Managers","author":"Author-Check- Article-or-Video","date":"May 1, 2021","format":false,"excerpt":"WindowUtilities.java Simplifies the setting of native look and feel. #################### import javax.swing.*; import java.awt.*; \/\/ For Color and Container classes. \/** A few utilities that simplify using windows in Swing. * ################### public class WindowUtilities { \/** Tell system to use native look and feel, as in previous * releases.\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\/10519","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=10519"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10519\/revisions"}],"predecessor-version":[{"id":10520,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10519\/revisions\/10520"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10519"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}