Trajectory. (1) Create a class Trajectory. It has attributes xs and ys, which each store a List[float], indicating all c

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Trajectory. (1) Create a class Trajectory. It has attributes xs and ys, which each store a List[float], indicating all c

Post by answerhappygod »

Trajectory 1 Create A Class Trajectory It Has Attributes Xs And Ys Which Each Store A List Float Indicating All C 1
Trajectory 1 Create A Class Trajectory It Has Attributes Xs And Ys Which Each Store A List Float Indicating All C 1 (51.71 KiB) Viewed 28 times
Trajectory. (1) Create a class Trajectory. It has attributes xs and ys, which each store a List[float], indicating all coordinates (x, y) that the object has ever been at. When creating a Trajectory, we shall provide the starting coordinate (x, y) of the object, like so: Exercise t = Trajectory (4.2, 5.1) (2) Create a method move to (x, y) that mutates the attributes so the object tracks where it has been: t.moveto (4.5, 6.2) t.moveto (4.3, 8.1) t.moveto (4.4, 6.0) t.xs [4.2, 4.5, 4.3, 4.4] t.ys [5.1, 6.2, 8.1, 6.0] (3) Create a method plot () that draws a plot of where the object has been. For example, t.plot() should draw a plot like the following: 8.0 7.5 7.0- 6.5 6.0 2 5.5 50 4.20 4.35 4.40 4.45 4.50 You may find it useful to implement additional magic methods such as repr_or_eq, but these will not be marked.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply