Modify Body (Program 3.4.1) so that the radius of the circle it draws for a body is
Question:
Modify Body (Program 3.4.1) so that the radius of the circle it draws for a body is proportional to its mass.
Transcribed Image Text:
Program 3.4.1 Gravitational body public class Body { py private Vector r; private Vector v; private final double mass; public Body (Vector r0, Vector v0, double m0) { r = r0; v = v0; mass = m0; } public void move (Vector force, double dt) { // Update position and velocity. Vector a = force.scale(1/mass); v = v.plus (a.scale(dt)); r = r.plus (v.scale(dt)); } public Vector forceFrom(Body b) { // Compute force on this body from b. b } public void draw() { force dt G delta dist magnitude Body a this; double G = 6.67e-11; Vector delta = b.r.minus(a.r); double distdelta.magnitude(); double magnitude= (Ga.mass * b.mass) / (dist dist); Vector force = delta.direction ().scale (magnitude); return force; StdDraw.setPenRadius (0.0125); StdDraw.point (r.cartesian (0), r.cartesian (1)); position velocity V mass mass force on this body time increment acceleration this body another body gravitational constant vector from b to a distance from b to a magnitude of force
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (2 reviews)
To modify the given Body class so that the radius of the circle it draws is proportional to its mass ...View the full answer
Answered By
Rinki Devi
Professional, Experienced, and Expert tutor who will provide speedy and to-the-point solutions.
Hi there! Are you looking for a committed, reliable, and enthusiastic tutor? Well, teaching and learning are more of a second nature to me, having been raised by parents who are both teachers. I have done plenty of studying and lots of learning on many exciting and challenging topics. All these experiences have influenced my decision to take on the teaching role in various capacities. As a tutor, I am looking forward to getting to understand your needs and helping you achieve your academic goals. I'm highly flexible and contactable. I am available to work on short notice since I only prefer to work with very small and select groups of students.
I have been teaching students for 5 years now in different subjects and it's truly been one of the most rewarding experiences of my life. I have also done one-to-one tutoring with 100+ students and helped them achieve great subject knowledge.
5.00+
2+ Reviews
10+ Question Solved
Related Book For
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne
Question Posted:
Students also viewed these Algorithm Design questions
-
Clear View, a radiology practice in Pretoria has 15 branches at hospitals and doctors practices in the area, some of which are only 3 kilometres apart. All bookings are managed separately by each...
-
The weight of an object at the surface of a planet is proportional to the planet's mass and inversely proportional to the square of the radius of the planet. Jupiter's radius is 11 times Earth's and...
-
The system shown in Fig. 14.17 is mounted in an elevator. What happens to the period of the motion (does it increase, decrease, or remain the same) if the elevator (a) Accelerates upward at 5.0 m/s 2...
-
The following inventory information is available for Ricci Manufacturing Corporation for the year ended December 31, 2017: Beginning Ending Inventories: Raw materials Work in process Finished goods...
-
Automobile insurance is much more expensive for teenage drivers than for older drivers. To justify this cost difference, insurance companies claim that the younger drivers are much more likely to be...
-
Write code to remove from the list any Strings that contain the letter "a". The following should be the lists contents after your code has executed: ["It", "IS", "stormy", "night"]
-
While many organizations try to incorporate cause-related marketing into their business operations, TOMS Shoes takes the concept of philanthropy one step further. TOMS blends a for-profit business...
-
The comparative balance sheets for 2011 and 2010 are given below for Surmise Company. Net income for 2011 was $50 million. Required: Prepare the statement of cash flows of Surmise Company for the...
-
I point Which equation can be used to correctly solve for the value of x in the right triangle? cos (49) cos (49) tan(49) = || = || = 2 14 14 sin (49) = 14 sin (49) tan(49) ***** || = 14 14 X 14 x 49
-
Modify the test client in Turtle to take an odd integer \(n\) as a command-line argument and draw a star with \(\mathrm{n}\) points.
-
What are the main headings to be found in most company balance sheets?
-
Today is December 12, 2008 and TIPS prices are in Table 7.8. (a) Use the extended Nelson Siegel model in Equation 7.28 to calculate the real discount curve and real yield curve. (b) Your estimates...
-
Prepare a purchases budget for Graham Murray for the periods January-June, July-December and for the calendar year. Use the following data: Budgeted sales income (in $000s) is: Jan - Jun 2,200 Jul -...
-
Which of the following are correct? a.In RSA, Private key is used for the decryption. b.To do authentication in RSA, we need to encrypt some data using a private key and decrypt it using a public...
-
7. We want to design a composite material for a boat body. The body of the boat is under two-dimensional stress during operation. The composite material must consist of 60% epoxy as matrix material....
-
Jennifer is running at 11 m/s. If Jennifer weighs 622 N, what is the magnitude of her linear momentum? Take the acceleration due to gravity as 9.80 m/s. Please round your answer to the nearest whole...
-
Luke owns a condominium in a resort town. In 2022, he rented the property for 10 days. He used the condominium for 20 days for his own personal use. The condominium was not used the rest of the year....
-
Assume that a B R Tire Store completed the following perpetual inventory transactions for a line of tires. Beginning...
-
What exactly is a prima facie duty? How does an ethic of prima facie duties differ from monistic and absolutist ethical theories?
-
Which messages in version 6 replace the IGMPv6 messages in version 4?
-
An IPv6 packet consists of a base header and a TCP segment. The length of data is 128,000 bytes (jumbo payload). Show the packet and enter a value for each field.
-
In which transition strategy do we need to encapsulate IPv6 packets in the IPv4 packets?
-
please help me with the website below to answer the questions wcms_760306.pdf (ilo.org) file:///C:/Users/carin/Downloads/wcms_760306%20(1).pdf A global survey of enterprises: Managing the business...
-
Manufacturing Company Balance Sheet Partial balance sheet data for Upper Crust Company at August 31 are as follows: Finished goods inventory $16,500 Prepaid insurance 16,800 Accounts receivable...
-
Lou Barlow, a divisional manager for Sage Company, has an opportunity to manufacture and sell one of two new products for a five- year period. His annual pay raises are determined by his division's...
Study smarter with the SolutionInn App