Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I scale the bodies so that they stay inside the 512-by-512 Turtle graphics window?

0
Posted

How do I scale the bodies so that they stay inside the 512-by-512 Turtle graphics window?

0

These are purely suggestions for how you might make progress. You do not have to follow these steps. • Review the Bouncing Ball program from lecture and the Student Precept List program from Section 2.5. • Copy the following files from /u/cs126/files/nbody into your working directory. It contains sample input files, Turtle.java, StdIn.java, and reference solutions. • Read in the data file planets.txt using StdIn.java, and print the information back out using System.out.println. • Now, read in the data file and store the information in several arrays. Let px[i], py[i], vx[i], vy[i], and mass[i] be real numbers which store the current position (x and y coordinates), velocity (x and y components), and mass of planet i. Let image[i] be a string which represents the filename of the GIF image used to display planet i. Print the information back out. • Step 3. Plot the background starfield.jpg image. Recall that Turtle.spot centers the image at the current location, so use Turtle.fly to pre-p

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123