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...
-
How do managers make decisions to implement strategy?
-
Explain how depreciation generates actual cash flows for a firm.
-
Make-or-buy and relevant costs The assembly division of Davenport, Inc., is bidding on an order of 50,000 smart phones. The division is eager to get this order because it has a substantial amount of...
-
Sketch a hand written a Enhanced ER diagram for this table and fix the error if there is Message cation D Notification UserNotif Password UserName UserID RoleID User D Phone User # Role securityID...
-
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?
-
Ribonucleotides are erroneously incorporated into newly synthesized DNA as a result of incomplete primer removal or misincorporation by DNA polymerase. What types of enzymes would be required to...
-
Is it important to build trust with participants before asking your participants the interview questions? Does this same trust building applies to leader-employee relationships, as well ?
-
Marina Comp. deposits all receipts and makes all payments by check. The following information is available from the cash records: MARCH 3 1 BANK RECONCILIATION Balance per bank $ 2 6 , 7 4 6 Add:...
-
Wingate Company, a wholesale distributor of electronic equipment, has been experiencing losses as shown by its most recent monthly contribution format income statement: Sales $ 1 , 6 5 6 , 0 0 0...
-
What object will the following code produce? glBegin(GL_POLYGON); glColor3f(1, e, e); glVertex3f(-0.6, 0.75, 0.5); glColor3f(0, 1, e); glVertex3f(0.6, -0.75, 0); glColor3f(e, e, 1); glVertex3f(0,...
-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 A Ready B Journal entry: Calculate the taxable income/tax loss and the current tax...
-
What can you do to protect your privacy online? Draw up a concrete list of steps that you might reasonably consider. Are there some actions that you would not be willing to take, either because they...
-
Discuss the concept of the looking-glass self. how do you think others perceive you? do you think most people perceive you correctly?
-
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?
-
Assuming that yesterday's closing price of the S & P 500 was 1000, the daily logarithmic return volatility estimated using the GARCH (1,1) model was 1.2 per cent. The parameters of GARCH model are =...
-
Lucido Products markets two computer games: Claimjumper and Makeover. A contribution format income statement for a recent month for the two games appears below: Sales Variable expenses Contribution...
-
A retail store is hoping that a new marketing campaign will improve their store sales. Given the schedule of annual incremental cash flows shown below, calculate the NPV and IRR of this project....
Study smarter with the SolutionInn App