Algo Yuk 2
Algo Yuk 2
INTRODUCTION
A. Background
The program to calculate the range of a cannonball from a building is a computer
program used to estimate the distance that can be achieved by a shell fired from the
cannon placed above building. This program can assist in military planning, testing
weapons, or in the simulation of certain situations. The program background involves
knowledge of physics and projectile mechanics. The basic principle used is the law of
motion parabola and other factors that affect the trajectory of such bullets initial
velocity, angle of fire, bullet mass, and air resistance. This program will ask for input
from the user in the form of initial speed bullet and firing angle. By using the relevant
formulas, the program will calculate the maximum distance that can be achieved by
the bullet. Some assumptions may be required, such as ignoring wind effects or
gravity changes with height.
This program will then provide output in the form of the maximum distance
reached by the bullet and possibly additional information such as time travel,
maximum height, or bullet speed when it reaches the maximum distance. In a
programming language, this program can be implemented using appropriate syntax
and algorithms, such as using C language. In C language, this program will involve
the use of variables, operators math, trigonometric functions, and maybe the use of
structures repetition or looping to perform the necessary calculations.
B. Purpose
1. Knowing the range of a cannon fired from the top of a building based on the
speed and initial angle of the shot.
C. Problem Formulation
1. What is the range of a cannon fired from the top of a building based on the
speed and initial angle of the shot?
D. Benefits
1. To find out the range of the cannon fired from above a based on the speed and
initial angle of the shot.
CHAPTER II
LITERATURE REVIEW
Vox = Vocos 𝜃
Voy = Vo sin 𝜃
Point A is the point when the ball has been moving for t seconds (during the
time certain ) at that point there are the following properties;
a. Vax = Vox (because on the x axis is the GLB which has the same speed)
b. The velocity at point A can be found by the equation (V ty at point A) Vty =
Vo sin 𝜃 – gt
Point B is the peak point or position at the maximum height where
has the following properties:
a) Vy = 0 (Vertical Speed Equal to zero)
b) Vbx = Vax = Vox = Vo cos 𝜃
c) Time to reach the peak (tp)
Vy = Vo sin 𝜃 – gt p
0 = Vo sin 𝜃 – gt p
Gtp = Vo sin 𝜃
d) Maximum height (y max or h max)
Vy² = Vo² sin 𝜃² - 2gy
0 = Vo² sin 𝜃² - 2gh max
2gh max = Vo² sin 𝜃²
e) Distance when y max (Xy max)
Xy max = Vo cos 𝜃 tp
The properties at point c are the same as point A because they are both at the
same height (symmetrical) So obtained:
Xmax = 2Vo sin 𝜃 cos 𝜃
Semi-parabolic motion is the motion of an object at first moves horizontally at
a certain height, so when it falls down it will form a half parabolic trajectory. Things
to note in this motion
1. In the downward vertical direction, the free fall motion equation applies y= h
= ½ gt²
2. In the horizontal direction, the GLB equation x = v.t applies (Siregar,
2022:14).
CHAPTER III
PRACTICUM METHOD
A. Time/Place
This practicum will be held on Friday, May 28 2023, at 13.00 WITA. Located
in the Computer Laboratory, Physics Department , Faculty of Mathematics and
Natural Sciences, State University of Makassar
B. Implementation
1. Programming Language
The programming language used in this lab is C language. C language
is a medium-level programming language used to develop operating systems,
application software, and devices Loud. C language is easy to learn and has a
simple syntax.
2. Platform
Online GDB is a programming tool that can be used to analyze and
improve the program interactively, which is usually used in software
development to assist programmers in understanding program behavior and
solving problems.
3. Software
Chrome is a web browser developed by the company google. It has
features such as speed, security, synchronization, expansion, and so on private
mode.
C. Working Principle
The working principle of the program to calculate the range of a
cannonball from a building in C language is as follows:
a. Declare required variables to store data like bullet initial velocity (v0), angle
of fire (theta), gravity (g), and distance (range).
b. Use a physics formula to calculate the range of a cannonball. this formula
based on parabolic motion and considering the initial angular velocity shoot,
and gravity. Distance can be calculated by the formula: range = (v0 * v0
*sin(2 * theta)) / g.
c. Show distance result to user. The program will ask the user to enter the initial
velocity of the bullet(v0) in meters per second and the firing angle (theta) in
degrees. Program then convert the angle from degrees to radians and calculate
the range cannon bullet using the parabolic motion formula. Result range then
displayed to the user in meters.
It should be noted that this program assumes the Earth's gravity to be 9.8 m/s²
(gravity constant value). You can change this value accordingly applicable gravity
values where you are if required.
CHAPTER IV
RESULTS AND DISCUSSION
A. Programming Results
2.Result Program
B. Data Analysis and Interpretation
In this case, the initial velocity of the bullet (v0) is 350 m/s, the angle of fire
(θ) is 60 degrees, and the height of the building (h) is 12 meters.
θ_rad = θ * (π/180)
θ_rad = 60 * (π/180)
t = (2 * v0 * sin(θ_rad)) / g
t = (2 * 350 * sin(1.0472)) / 9.8
t ≈ 19.3546 seconds
After getting the time, we can calculate the horizontal distance traveled by bullet
using the formula:
Horizontal_distance = v0 * cos(θ_rad) * t
Horizontal_distance = 350 * cos(1.0472) * 19.3546
Horizontal_distance ≈ 21661.03 meters
So, with an initial velocity of 350 m/s, an angle of fire of 60 degrees, and
altitude building is 12 meters, the range of the cannonball shot is about 21661.03
meters.In the interpretation of this program allows the user to calculate shot distance.
The user is asked to enter date used to calculate the distance traveled. Programs use
formula t = (2 * v0 * sin(θ_rad)) / g and Horizontal_distance = v0 * cos(θ_rad) * t,
for calculate the distance traveled. After receiving input from the user, the program
performs calculations using those formulas and generates the output is the distance
traveled. So it produces the same result using the C language program which
automatically equals 21661.03 meters and results using manual calculations of
21661.03 meters. This matter causes no errors in entering values into the program C
language. Using this interpretation, users can apply C language program for various
cases in calculating the volume of geometric shapes and get useful information about
different wake volumes.
3. Discussion
In activity 1 we were given the wrong program and we fixed it the
programme.
In activity 2, discusses making a program to calculate reach cannon shells from a
building. The purpose of this program is to determine the distance that can be traveled
by a cannonball taking into account factors such as angle of fire, initial velocity, and
building height.
In the program development process, the steps that have been taken include:
input data such as the initial velocity of the bullet, the angle of the throw, and the
height of the building. Program it uses a physics formula to calculate the range of a
cannonball.
First, the program validates the input provided by the user to ensure that the
data has the correct type and meets certain conditions, such as the height of the
building must be greater than zero and the angle of fire must be within that range
valid.
Next, the program uses trigonometry formulas to calculate time required for
the bullet to reach the height of the building. After that, program use kinematics
formulas to calculate the horizontal distance traveled by bullets in that time.
In the development of this program, attention is also paid to special cases, such as
when the bullet does not reach the height of the building or the horizontal distance
traveled negative. The program gives appropriate error messages in case those cases
occur the. This program has been tested with various input combinations and yielded
results consistent and accurate.
CHAPTER V
CLOSING
A. Conclusion
Based on the results of the practicum that has been carried out, it can be
concluded that: the program that has been made successfully calculates the range of
the cannonball from a building taking into account factors such as angle of fire, initial
velocity, and building height. This program makes it easy for users to get information
about the distance that can be traveled by cannon shells in the specified situation. In
program development Furthermore, the addition of additional features can be
considered, such as takes air resistance into account, for increased accuracy and
realism calculation.
B. Suggestion
Based on computer programming experiments that have been done, I I will
give suggestions that are constructive, namely So that the practitioner understands the
concept of Programming Algorithms with using C language and mastering how to use
the platform certain to make it easier to run programming in correctly complete this
Alternating Straight Motion calculation. Pay attention to the practitioner during the
practicum so that it doesn't happen often errors in practice and To provide equipment
for practicum.
BIBLIOGRAPHY