0% found this document useful (0 votes)
22 views14 pages

Algo Yuk 2

The document describes a program to calculate the range of a cannonball fired from the top of a building based on initial velocity and firing angle. It discusses the relevant physics concepts of parabolic motion and presents the key formulas used. The practicum method section outlines that the program will be implemented in C language using online GDB. It will ask the user to input the bullet's initial velocity and firing angle, then calculate and display the maximum range based on the parabolic motion formula. The results section shows sample output for an initial velocity of 350 m/s and firing angle of 60 degrees, with the calculated range being approximately 21,661 meters.

Uploaded by

Hadrian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views14 pages

Algo Yuk 2

The document describes a program to calculate the range of a cannonball fired from the top of a building based on initial velocity and firing angle. It discusses the relevant physics concepts of parabolic motion and presents the key formulas used. The practicum method section outlines that the program will be implemented in C language using online GDB. It will ask the user to input the bullet's initial velocity and firing angle, then calculate and display the maximum range based on the parabolic motion formula. The results section shows sample output for an initial velocity of 350 m/s and firing angle of 60 degrees, with the calculated range being approximately 21,661 meters.

Uploaded by

Hadrian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

CHAPTER 1

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

Algorithm is a technique of compiling steps for completion problems in the


form of sentences in a limited number of words but arranged in an orderly manner
logical and systematic. a clear procedure to solve a problem by using certain steps
and limited in number, namely each clear and unambiguous, a definite arrangement
of steps, which, if followed, will be transform input data into output in the form of
information. Algorithm discovered by a scientist in the middle east of the era of the
Islamic civilization named Abu Jafar Muhammad Ibn Musa Al Khawarizmi (780 –
850 AD) and said According to some scientists, the algorithm is taken from its name,
namely Al - Khawarizmi. Judging from the language, the algorithm comes from the
word algorism means calculations in Arabic numerals but historians have difficulty
find the origin of this term until they finally found that algorithm / Algorithm comes
from the name of the inventor, the presentation of the algorithm is usually contained
in the form of Pseudecode, Flowchart, and diagrams (Putro, 2019 : 2)
Computer programming is an iterative process of writing and editing. The source
code thus forms a program. Editing source code includes the process of testing,
analyzing, correcting errors, algorithm optimization, and code normalization
( Saragih, 2020: 4)
Programming in C is a process of writing, testing, and run computer programs
using the C programming language is one of the most widely used high-level
programming languages development of system software, embedded software, and
devices application software.C language is in the category of programming languages
that can distinguish the size of the letters used in writing the code this program means
that in writing program code you have to be more thorough, because if Wrong writing
the size of the letters will affect the final result of the program (Khakim, 2019; 6).
In this practicum, we will examine the Cannon Range Material fired from the
top of a building based on initial speed and angle shot. Parabolic motion is a motion
whose trajectory is shaped parabola.Parabolic motion is a two-dimensional motion
that combines two axes namely the horizontal axis (x axis) and the vertical axis (y
axis) On the axis horizontal is Uniform Straight Motion and Vertical Axis is
Alternating Straight Motion. The principle of Parabolic Motion really applies to
motion kalua objects: homogeneous earth, the height of the object is fixed, the air
pressure is small. (Rajagukguk, 2018: 1).
Parabolic motion or bullet motion is motion with a shaped trajectory parabola
(half the trajectory). Examples of this motion are cannon shots, punches badminton,
when throwing a basketball into the ring. In the motion of the parabola there is an
angle
Parabolic motion is a combination of two components of motion, namely
horizontal (x-axis) and vertical (x-axis) components y). The x-axis component is
GLB, where the velocity is in the horizontal direction in any position is fixed
(constant). On the y-axis component, parabolic motion is GLBB slowed down
because it is against gravity (a=- g). Based on the picture, each point can be discussed

At the starting point there is vo (initial velocity) there are 2 components,


namely Vox Initial velocity on the x-axis) and Voy (Initial velocity on the y-axis)

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

1. Activity 1 : Distance of shot

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.

First, we need to convert the shot angle from degrees to radians:

θ_rad = θ * (π/180)

θ_rad = 60 * (π/180)

θ_rad ≈ 1.0472 radians


Next, we can calculate the time taken by the bullet to reach

the height of the building using the formula:

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

Ainiyah, K. (2018). Basic Physics Surgery. Yogyakarta: Deepublish.


Rajagukguk, J. (2018). Modeling and analysis of two-dimensional parabolic motion
with
using the GuiMatlab application. Journal of the University Physics Alumni
Association
Medan State, 1.
Rohmah, M.F. (2020). Theory and Application of Programming Algorithms With
C and C++ languages. Jakarta: Nem.
siregar, a. c. (2022). Basic physics volume II. Jakarta: CV KANAKA MEDIA.
Yuliana, C.d. (2021). Basic physics theory and applications. Aceh: Publisher
Foundation
Muhammad Zaini. .

You might also like