Posted : Friday September 9
Due : Monday September 19, noon
You must do this assignment INDIVIDUALLY and follow all the directions in the course lab manual, available on the course web page, regarding assignment submission. Marks will be deducted if you do not follow these directions. Assignments must be submitted electronically via the Virtual Campus.
Your algorithms must be developed using the format seen in class, and you should not use any structures (for example, loops or branches) that have not yet been covered in the lectures.
Answer the following questions. You should be able to find the answers by consulting the course web pages, the SITE introductory lab guide, and the university’s web site. Remember to acknowledge your sources!
a) According to the ITI 1220 policy on plagiarism, what sorts of things can you discuss with your colleagues and classmates? Should you take notes of such discussions?
o
You may discuss assignments with friends and classmates, but only up to
a point: you may discuss and compare general approaches and also how to get
around particular difficulties, but you
should not leave such a discussion with any written material. You should
not look at another student's solution to an assignment on paper or on the
computer screen, even in draft form. [From ITI 1220 web page link]
b) According to the User Code of Conduct for Computing Resources, what are you required to ensure about the use of your account and computing resources?
o
Ensure their accounts
and computing resources are used only for authorized activities. [SITE home page > Course/lab material > SITE
computing documentation > Introductory Guide > Ethics > University’s
Code of Conduct. The direct link is http://www.uottawa.ca/help/about/code.html
c) In the Undergraduate Studies Calendar, the regulations regarding Academic Fraud contain a list of sanctions that may be applied to a student when academic fraud is committed or attempted. What are the first three sanctions on the list?
o
a) the mark of F or zero
for the work concerned;
b) the mark of F or zero for the course concerned;
c) the mark F or zero for the course concerned and the loss of all or part of
the credits for the academic year concerned and/or an additional requirement of
3 to 30 credits added to the student’s program of studies.
o
[SITE home page >
Click on C (calendar) icon, near top right > Academic Fraud. The direct link is
http://www.uottawa.ca/academic/info/regist/crs/home_5_ENG.htm]
d) If you see a problem with a Relmon laser printer, and you believe the problem is within SITE, to what e-mail address should you send a message describing the problem?
o If you think the problem is within SITE, you can send a note explaining the problem in details to software@site.uOttawa.ca.
o
SITE home page >
Course/lab material > SITE computing documentation > SITE printing
documentation > 1.2 - There are problems with the Relmon printers. What
should I do? The direct link is
http://www.site.uottawa.ca/local/labinfo/printing.shtml#Section1.2
Using the uOttawa webmail system, send an e-mail to the Teaching Assistant for your lab section, who is listed on the web page at http://www.site.uottawa.ca/~awilliam/iti1220/Schedule.html.
The e-mail message that you send should contain the
following information:
This question has some exceptional procedures:
Save a copy of the file “Template for ITI 1220 programs.” This file is available from the virtual campus. Modify this file so that the identification information is correct for you, and that it is for Assignment 1, Question 3. (Note that this information is in two places; be sure to modify the file in all necessary locations.) After you have made the changes, submit the revised file as part of your assignment. As per the general assignment instructions, the file name should be A1Q3.java.
Note: You do not have to compile the file (although you can if you wish), nor do you need to submit a file A1Q3.class in this specific case.
After a long session of programming in the SITE labs, one naturally wants to return home as quickly as possible. Suppose that there are two options to travel from the SITE building to where you live, both of which follow the same route.
1. You can walk the entire distance.
2. You can ride one bus for most of the trip, but you still have to walk to and from the nearest bus stop at each end of the trip, and there is a waiting time for the bus to arrive.
Design an algorithm that will compute the time it will take to travel home for both of walking and taking the bus, taking into account the following:
[Sources: OC Transpo’s “Trip
Planner” and route #1 schedule, Google maps]
Be careful to fully describe the algorithm, as to what values are given, what the algorithm's results are, and what assumptions and constraints there are on the algorithm.
Note: There are many combinations of values that
could be the GIVENS. The following is a
sample only. If a specific value is
mentioned in the problem, it can be assumed to be a constant value. If a value in a problem is not specified, it
should be in the GIVENS list.
GIVENS:
SITEToHomeDistance (distance from SITE to
home, in metres)
BusStopToHomeDistance (distance from the
nearest bus stop to home, in metres)
BusWaitTime (time spent waiting for bus, in
minutes)
RESULTS:
WalkingTime (time taken to walk home, in
minutes)
BusTime (time taken to use the bus to get
home, in minutes)
HEADER:
(WalkingTime, BusTime)
← TimeToGoHome( SITEToHomeDistance,
BusStopToHomeDistance, BusWaitTime
)
ASSUMPTIONS:
All times, distances are positive or zero.
The distance from SITE to home is at least 400 metres.
CONSTRAINTS
If all distances are given, SITEToHomeDistance
must be the sum of 400 + bus ride distance + BusStopToHomeDistance
BODY
WalkingTime ← SITEToHomeDistance
/ 65.0
BusTime ← 400.0 / 65.0 + BusWaitTime + ( SITEToHomeDistance
– 400.0 – BusStopToHomeDistance ) / 220.0 + BusStopToHomeDistance / 65.0
4 parts to bus time: walking 400 metres from SITE to bus stop at
65 m/min, waiting for the bus, time taken on the bus (bus distance / 220 ), and
the walk from the bus stop to home
Recently, the media has been asking engineers for an
estimate of how long it will take to drain the water from the city of
Even before hurricane Katrina, it was necessary to have
pumps to remove rainfall from
Suppose that you have a rectangular area that needs to be drained during a period of rain. You have pumps with a rated removal capacity. The pumps are not started until a specific number of millimetres of rain have fallen. However, as the pumps are running, it continues to rain with a constant rate of accumulation.
It has been decided that it is desirable to be able to completely remove water from the area within 2 hours after the pumping systems are started.
Design an algorithm to calculate the pumping capacity required to remove rain in 2 hours for a specified area specified by length and width dimensions, and for specified prior rainfall accumulation and rate.
Be sure to account for the following:
· The area to be drained has length and width dimensions measured in metres
· The previous rainfall accumulation is measured in millimetres
· Rainfall rate is measured in millimetres per hour
· Pumping capacity is measured in litres per hour
For example: Suppose that you have an area that is 3 metres by 5 metres, and rain has already accumulated to a height of 6 millimetres. The rate of rain is 2 millimetres per hour. The algorithm would return the value 75 litres per hour as the pump capacity that is needed.
It may be useful to remember that one litre represents a volume of water that is a cube with sides of 100 millimetres.
General strategy: find the volume to be drained.
First, convert measurements in
metres to millimetres, so that all three dimensions are in common units. Next, find the volume of the water to be
drained in cubic millimetres. The height
is the initial height, plus the accumulation that would happen over 2 hours at
the specified rainfall rate. Convert
this volume to litres. Divide the volume
by 2, as the pump has to drain this volume over two hours.
GIVENS:
AreaLength (length of area to be drained, in
metres)
AreaWidth (width of area to be drained, in
metres)
InitialRainfall (height of initial rainfall,
in millimetres)
RainfallRate (rate at which rain is falling,
in millimetres per hour)
RESULTS:
PumpCapacity (capacity, in litres per hour,
required to drain area in 2 hours)
HEADER:
PumpCapacity ← DrainIn2Hours(AreaLength, AreaWidth, InitialRainfall, RainfallRate)
ASSUMPTIONS:
All givens are zero or positive.
CONSTRAINTS
(none)
INTERMEDIATES
VolumeInCubicMillilitres (Volume of all water
to be drained, in cubic millimetres)
VolumeInLitres (Volume of all water
to be drained, in litres)
BODY
VolumeInCubicMillilitres ← AreaLength × 1000.0 × AreaWidth ×
1000.0 × ( InitialRainfall
+ 2.0 × RainfallRate )
VolumeInLitres ← VolumeInCubicMillilitres
/ (100.0 × 100.0 × 100.0 )
PumpCapacity ← VolumeInLitres
/ 2.0