For this program you will determine the time and impact velocity of a cat falling from a building. All three motion graphs of the cat will be displayed.
INPUTS:
A user will enter height of fall and initial velocity
The user will also select a planet from a dropdown list.
OUTPUTS:
A display statement will be printed to the screen which includes the impact velocity as well as the time until impact.
D-T, V-T and A-T graphs will be presented representing the motion of the cat.
CRITERIA & CONSTRAINTS:
Your program should have an impressive interface. (colors and graphics)
A dropdown list of planets as well as the moon should be offered.
Create a function called catsplat( )
Create a variable called sheet to get the active sheet.
To create a dropdown menu of planets we need to create a Validation variable called planets. This can be done like: var planets = SpreadsheetApp.newDataValidation().requireValueInList(['Planet 1','Planet 2','etc'], true).build();
Create a variable called set_planets and assign the validation to it as follows: var set_planets = sheet.getRange("H9").setDataValidation(planets);
Create variables called height, initial_V and planet and get them from the user input boxes.
Create a variable called "g" and assign it the value of -9.81.
You will be using if - else if - else if - else statements to reassign "g" based on the planetary body selected by the user.
Create a variable called final_V1 and calculate the impact velocity in m/s.
Create a variable called final_V2 and convert the impact velocity to mph.
Create a variable called time and calculate the total time until impact.
Create a variable called time_int and assign it time/10. We will be using this as our x-axis on the motion graphs.
To make our data table, create four empty array variables called times, distances, velocities and accelerations.
Re-use the time variable and originally set it to be 0
Create a for loop from 0-10 incrementing by 1.
Push the time variable to the times array.
Print times[i] to row i+139 and column 24 so the data table is clear out of the way of the user interface.
Add time_int to time.
Calculate the distance based on times[i] and push it to the distances array
Print distances[i] to row i+139 and column 25.
Calculate the velocities based on times[i] and push it to the velocities array.
Print velocities[i] to row i+139 and column 26.
Push g to the accelerations array.
Print accelerations[i] to row i+139 and column 27
Add the three motion graphs to your user interface getting data from the data table in columns 24-27
Create a button for the user to click which will update the motion graphs after the user enters information.