Assignment 1
Learning Outcome:
Define the basic functional components of a computer system, operation and inter-connection (3%)
Apply programming concepts to computing problems (7%) Weight: 10%
Part 1: Programming – Tin Can Mail
Problem Statement
This assignment is inspired by the mail delivery system of Niuafo’ou, the northern most island of the Kingdom of Tonga. Niuafo’ou is actually a volcano, which descends steeply into the sea and has a crater lake in its middle. Due to its steep slopes into the sea, it has no proper port or harbour, and even landing by boat on one of the few stony beaches can be dangerous.
In the 1880s, the Tin Can Mail mail delivery system was developed: Incoming mail was put into a tin can and thrown overboard close to the island from a mail boat, and outgoing mail in a tin can was shot out to sea by means of a cannon to be picked up by the mail boat.
Tin Can Mail became famous beyond Tonga, with special stamps that have become collector items all over the world. This system lasted for a hundred years until 1983, when an airfield was built, and mail could be delivered by plane.
In this assignment you are asked to determine the trajectory of the outgoing tin cans, given launch speed (muzzle speed of the cannon), launch angle and wind speed by means of Euler’s integration formula as shown in Figure 1. Your program is to simulate the trajectory and estimate the landing position of the tin can. It must take into account the air resistance and wind, since there will be usually a sea breeze blowing towards the coast. The simulation is based on classical equations for projectiles and air resistance.
Equations
The position of the tin can over time is modelled by the functions 𝑥(𝑡) and 𝑦(𝑡), and the speed of the tin can over time is modelled by the functions 𝑣s(𝑡) and 𝑣y(𝑡), where x is the horizontal direction and y is the vertical direction, as shown in Figure 1. The drag forces 𝐹s(𝑡) and 𝐹y(𝑡) slow the projectile down in x and y direction, respectively. For low speeds, this force can be approximated as growing linearly with the relative speed of the projectile with respect to the breeze. Assuming a sea breeze with constant (negative) wind speed 𝑣ws, the drag forces are:
𝐹s(𝑡) = −𝑐d(𝑣s(𝑡) − 𝑣ws) and
𝐹y(𝑡) = −𝑐d𝑣y(𝑡) − 𝑔
where 𝑐d is the drag coefficient and 𝑔 is the acceleration due to gravity.
Our approximation uses Euler’s integration method, which assumes that from the launch at time t=0, the projectile’s movement is simulated in many very small time steps where during each time step the projectile moves a very small distance and its speed is diminished by a very small amount as well.
During one time interval ∆𝑡, the tin’s position changes as
𝑥(𝑡 + ∆𝑡) = 𝑥(𝑡) + 𝑣s(𝑡)∆𝑡
𝑦(𝑡 + ∆𝑡) = 𝑦(𝑡) + 𝑣y(𝑡)∆𝑡
and during the same time interval, the speed of the tin is slowed down by the drag as
𝑣s(𝑡 + ∆𝑡) = 𝑣s(𝑡) + 𝐹s(𝑡)∆𝑡
𝑣y(𝑡 + ∆𝑡) = 𝑣y(𝑡) + 𝐹y(𝑡)∆𝑡
Initially we have 𝑥(0) = 𝑦(0) = 0, 𝑣s(0) = 𝑐 cos 𝛼, and 𝑣y(0) = 𝑐 sin 𝛼
where 𝑐 is the launch speed and 𝛼 the launch angle.
Wind Speed
For the wind speed, the program should use the Beaufort Scale. It asks the user to enter a Beaufort number as defined in Table 1. If the number entered is between 0 and 6, the program uses the wind speed from the Table. If the number entered is 7 or above, the program is to inform the user that it is no longer safe to launch a tin can, due to the strong wind.
Approximating the Trajectory
In your C++ program, implement the equations above with suitably named variables and constants of the correct types. Implement the iteration of the many time intervals as an appropriate loop that terminates when the projectile hits the water (𝑦(𝑡) = 0). Make sure that it does terminate!
Use the values in Table 2 for those variables (Note that our initial speed is named c and our speed of sea breeze is named 𝑣ws and must be negative!):
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
Get Free Quote!
433 Experts Online