Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

y acceleration: This function takes in no parameters andreturns the new y accele

ID: 3609207 • Letter: Y

Question

  • y acceleration: This function takes in no parameters andreturns the new y acceleration (double), based on a thruster valueentered by the user (note that this new acceleration will bethe acceleration that applies over the next 40-second period).
    This function should ask the user for a thruster value of (h)igh,(m)ed, (l)ow, or (n)one:
    • If the user answers high, the function should return a yacceleration of 4.0.
    • If the user answers med, the function should return a yacceleration of 2.0.
    • If the user answers low, the function should return a yacceleration of 0.0.
    • Otherwise, if they answer none or give an invalid response, thefunction should return a y acceleration of -1.6 (i.e. no thruster,just the downward acceleration due to gravity).
    Notice that this function does refer explicitly to the yacceleration - in this program, the acceleration in the x directionis fixed at +1.5 at all times.
  • ccc_win_main: Your program should initially output 40 Points,each Point corresponding to the position after 1 more second withno thruster (i.e the y acceleration is just the -1.6 due togravity).
    Only after outputting these first 40 Points (i.e. at t = 40seconds), you should ask the user for a new thruster setting.
    The final position & velocity values from the preceding periodwill now become the your new initial position & velocity;and with the new y acceleration (obtained from the new thrustersetting) you will be able to start a new 40-second period: start tover again (set it to 0) and output 40 more Points, one persecond.
    Continue repeating this process indefinitely (use an infinite loop,meaning that you will have to type CTRL-C in the console to killthe program when you get tired of it!).
    Alternatively (and more elegantly!), you may have the programterminate when the Point goes outside the bounds (upper, lower,left, or right) of the window - 5 bonus points if you can doit! (Note: to obtain bonus points you must indicate tothe grader in a comment in the header that you have implemented thebonus requirement)

Explanation / Answer

y acceleration: This function takes in no parameters andreturns the new y accele