Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I dont know what im doing wrong. please help me i dont understand this at all and its die in 2 hours ew History Bookmarks

I dont know what im doing wrong. please help me i dont understand this at all and its die in 2 hours image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
ew History Bookmarks People Tab Window Help slam Short History Karen AX 8108 Dashboard Gradesco x CS Assignment 4: Computing will * Not Secure cs-people.bu.edu/azs/cs108/assignments/a04.html Chego Tutors On Task 1: Physics for Game Developers 40 points; individual-only In this assignment, you will be writing the core of a new computer game, one that is categorized among the long and illustrious line of "artillery games! You will begin by writing two functions which will implement the physics/trigonometry calculations to aim a cannon at a distant target, taking into considering the angle of launch, initial velocity and the Earth's gravitational constant. This diagram gives a general sense of the factors involved in these computations: Assumptions 2).xlsx L LC model (1).xlsx LC model.xlsx C Chege Tutors Online Tutorin tory Karen A X C S108 Dashboard Gradescop X CS Assignment 4: Computing with x Not Secure cs-people.bu.edu/azs/cs108/assignments/a04.html Assumptions The cannon is aimed directly at the target (no left/right adjustments are needed) Cannonballs follow a purely ballistic trajectory, bounded by the launch's initial velocity and the angle at which they are launched Angles (e) are expressed from 0 to 180', where angle 0' is parallel to the ground, 90 is perpendicular to the ground, and angle 180 is parallel to the ground in the opposite direction from angle 0. Distances (D) are expressed in meters. Positive distances are in front of the cannon and negative distances are behind the cannon. The ground is entirely level, there are no hills or valleys. There is no wind and no drag. Trigonometric Calculations The following equations will be helpful for implementing the "math" for this assignment. Calculating the distance from launch angle and initial velocity: v2 D= no sin (20) Calculating the launch angle from distance and initial velocity o = 1 / arcsin (280 Karen AX CS108 Dashboard Gradescop X CS Assignment 4: Computing with X C Chege Tutors Online Tutorinox Secure cs-people.bu.edu/azs/cs108/assignments/a04.html Vis the initial velocity in meters/second D is the distance to travel . is the launch angle in radians . 9.8 meters/second2 is the gravitational constant on Earth Implementation Details Create a new Python code file and save it with the name a84_artillery-games.py. You will need to add these two lines at the top of your file to access some libraries for this program: import math import random You will be using functions such as math.sin, math.asin, math.radians, math.degrees, and random.randint. We recommend that you experiment with all of these functions at the Python console, and get comfortable with calling them. Remember that you can call help(function_name) on any function to see how it works. Also note: Python trigonometric functions are designed to work with radians! Write the following functions: 1. The function calculate projectile distance(launch angle, initial velocity) will compute and return the distance (in meters) that a projective will travel, given its initial launch_angle (in degrees) and its initial velocity in meters/second. For example, the function call calculate projectile distance(25, 50) tells us that a projectile launched at 25 degrees with an initial velocity of 50 meters/second will travel 195.41958079565763 meters before it hits the ground. 2. The function calculate_launch_angle(distance, initial velocity) will compute and return the required launch angle in degrees) to hit a target at a known distance (in meters) given its initial velocity in meters/second. For example, the function call calculate_launch_angle(250, 50) tells us that to make a projectile travel 250 meters with an initial velocity of 50 meters/second, we need to aim the cannon at 39.26082952273321 degrees. mebug Terminal Window Help 804_artillery-games.py - Untitled (Workspace) Welcome a 04_artillery-games.py a01_four_fours.py Users > sophie > Desktop > a04_artillery_games.py > ... import math import random 8 10 -: initial velocity initial velocity - int (input("Enter the initial launch velocity (in m/s):")) # projectile distance 14 launch angle - int(input(" enter the launch angle (in degrees) :") def calculate projectile_distance(launch_angle, initial velocity) "I returns the projectile distance return (initial velocity ** 2 / 9.8) (math.sin(20)) #launch angle def calculate_launch_angle(distance, initial velocity) returns the launch angle". return (1/2) (math.asin) (9.8/initial velocitye-2) (distance) #print here PROBLEMS 1 OUTPUT DEBUG CONSOLE TERMINAL 1: Code Sophies-MacBook Air-31assignment 3.py sophies /Library/Frameworks/Python.framework/Versions/3. /Desktop/a4_artillery_games.py" /Users/sophie/Desktop/a64artillery_games.py:24: SyntaxWarning: 'float' object is not callable return (1/2) (mathasin) (9.8/initial velocity *2) (distance) Enter the initial launch velocity (in m/s):5 enter the launch angle (in degrees):5 Sophies-MacBook Air-3 assignment 3.py sophies /Library/Frameworks/Python. Framework/Versions/3.& /Desktop/a64_artillery_games.py" /Users/sophie/Desktop/a64_artillery_games.py:24: SyntaxWarning: 'Float' object is not callable; return (0,5) (math, asin) (9.B/ initial velocity2) (distance) Enter the initial launch velocity (in m/s)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

5. If yes, then why?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago