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!):
20 Answers
88 Answers
DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Functions and Arrays – to solve computationalproblems.Arrays provide a convenient way to store &
The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is anPath 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 through certain obstacles. As the main aim is to thinkabout path finding, we focus on the common task
Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individualDevelop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. TheLineItem class will represent an individual line item of merchandise that acustomer is purchasing.
SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define: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 Sea Ports. Here are the classes and their instance variables we wish to define: SeaPortProgram e
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 Sea Ports. Here are the classes and their instance variables we wish to define: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 Sea Ports. Here are the classes and their instance variables we wish to define: SeaPortProgram e
The first programming project involves writing a program that parses, using recursive descent, a GUI definition language defined in an input file and generates the GUI that it defines. The grammar for this language is defined below:1Project 1The first programming project involves writing a program that parses, using recursive descent, a GUIdefinition language defined in an input file and generates the GUI that it defines. The grammar for thislanguage is defined below:gui ::= Wi
CMSC 335 Project SeaPort Solved Project 3 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 Sea PortsCMSC 335 Project SolvedProject 3 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 Sea Ports. Here are the classes and their instance variables we wish to define:
CMSC 335 Project 4 Solved SeaPort 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 Sea Ports Here are the classes and their instance variables we wish to defineProject 4 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 Sea Ports. Here are the classes and their instance variables we wish to define: SeaPortProgram ext
CMSC 451 Project 2 Solved The second project involves completing and extending the C++ program that evaluates statements of an expression language contained in the module 3 case studyProject 2 The second project involves completing and extending the C++ program that evaluates statements of an expression language contained in the module 3 case study. The statements of that expression language consist of an arithmetic expression f
CMSC 451 Project 1 Solved The first project involves benchmarking the behavior of Java implementations of one of the following sorting algorithms bubble sort selection sort insertion sort Shell sort, merge sort quick sort or heap sortCMSC 451 Project 1The first project involves benchmarking the behavior of Java implementations of one of thefollowing sorting algorithms, bubble sort, selection sort, insertion sort, Shell sort, merge sort,quick sort or heap sort. You must post your
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.
Get Free Quote!
270 Experts Online