程序代写案例-EPRO1004
EPRO1004 - 202003
Home-based Programming Assignment
Instructions (Read Carefully):
1. This is an open book programming assignment. You are allowed to use online
resources to assist in this assignment;
2. This is an individual assignment and no collusion with other students of any kind
is allowed;
3. Your program has to work. That means it has to compile correctly, run according
to specifications, and give correct results. The submitted assignment must also
meet the following criteria:
 Good design, including good pseudo code, logic diagrams and
algorithms
4. You must observe good programming practices, including comment,
documentation, and readability of your program;
5. To facilitate program readability, you must include function calls in your program
whenever possible;
6. All names of constants, types, variables, functions, etc. must be "self-
documenting" and "self-describing." For example, you should name a variable
total if it is used to store a total. Give a function a name like printList if its job is
to print a list;
7. This home-based programming assignment constitutes 40% of the overall final
mark of the EPRO1004 unit.
8. Final submission deadline is 23:00, 24th January. The instructions on how
to submit your file will be provided by your Unit Coordinator as soon as
possible.
Page 1 of 6
3 December 2020
V1
Calculating the flow in a rectangular channel for a variety of
construction materials and slopes
Background
The design of a rectangular channel must take into account a range of factors. For
example, if you use the Manning formula, which this assignment will be, width, depth, slope
of the actual channel and the material of construction are what you have to take into
account.
An example of an open channel can be seen in Figure 1. In the picture shown, this
channel is taking water through an orchard.
This assignment is limited to a rectangular channel shape and flows will be
calculated using the Manning Equation1.
Manning is a relatively simple equation with the required parameters illustrated in
Figures 2 & 3. The formula gives you the velocity of the flow, which if in turn is multiplied by
the channel cross sectional area will give you the flow rate.
1 https://www.engineeringtoolbox.com/mannings-formula-gravity-flow-d_800.html
Page 2 of 6
3 December 2020
Figure 1: An open channel in north western Victoria
Figure 2: Channel cross section Figure 3: Channel longitudinal
V1
Manning Equation
velocity=(1
n
)Rh
0.67 S0.5
where

Rh=Hydraulic Radius=
A
P
where
A=area=b×y
P=wetted perimeter=b+2 y
and
S=bed slope= rise
run
and
n=Manning roughness factor 2
Now to get the flow rate, the calculated velocity is simply multiplied by the area, the same
area as calculated for Rh.
flow rate=(b×y)×((1n )Rh0.67 S0.5)
All units are metres, seconds, kilograms
Requirements
This assignment will involve writing a simple application that will calculate the flow
capacity of a simple rectangular channel using a combination of slopes and materials of
construction.
The app will ask the user for the geometry of the channel as shown in the above
figures. Taking these values in conjunction with material roughness factors, which will be
retrieved from a text file, a matrix of material roughness Vs incrementing bed slopes will be
produced. The body of the matrix will contain the flow rates. The matrix will be output to both
the screen and a file.
The bed slope will initially be input by the user, using rise and run, but will then be
incremented by a factor of 0.05 four additional times and the flow calculated for each slope
value.
2 https://www.engineeringtoolbox.com/mannings-roughness-d_799.html
Page 3 of 6
3 December 2020
V1
For example, as can be seen in Figure 4, the first material of construction is Asphalt.
The channel has an initial bed slope of 0.01 and for this pair a flow rate is calculated. The
slope is then incremented by 0.05, 0.06, the flow calculated again, the slope incremented by
0.05, 0.11, flow calculated and so on. This is repeated for each of the five materials that are
in the parameter file. n.b. Figure 4 is only an example. The app must be able to handle
different materials and different slopes, providing the correct flow rates.
Page 4 of 6
3 December 2020
Figure 4: Example App output
V1
P rogramming Tasks
Your task is to develop a working C program that will:
• Automatically open a data file that contains the Manning roughness values. There
should be five entries, one per line, in this file. Each line will consist of a name for the
material and the associated roughness. The name of the file is up to the developer
but should reflect the contents of the file.
• Open then read the data file. If the file is not found, appropriate action should be
taken.
• Ask the user for the appropriate geometric values, channel width & depth, rise and
run. There should be range checking on the depth only. The user must enter a
positive number.
• Draw a shape, using stars and dashes that gives an indication of the size of the
channel. Refer to Figure 4. In this example, you will see that the input width is 12m
hence there are 12 stars between the walls. The depth is 10m hence there are 10
stars from the base to the water surface. The water surface consists of stars and
dashes. There should be one star above the water surface. The dimensions of the
channel should also be labelled approximately as shown in the figure. Obviously the
size & shape will change depending upon the entered channel dimensions.
• A table should be created that has the slope as the X axis and the materials as the Y
axis, refer to the bottom section of Figure 4. None of the information in the table shall
be hard coded – it should all be either read from the data file or calculated. If the
name of a material is changed in the file, the entry in the Y axis will change. If the
initial slope is changed, due to different data entry, then the slope values will also
change. The flow rates will to be calculated for each material/slope pair.
• The channel shape and the results table will need to be written to both the screen
and a text file. The text file shall be named theAdventuresOfZorro.txt. The opening of
the results file must be checked to ensure it is successful. If not successful, an error
message output and appropriate action taken.
You should demonstrate good programming practise, making use of functions and return
values. As files are being opened, care should be taken to ensure the opening has actually
succeeded. Magic Numbers should not be used. The code should be well laid out and
consistent in format. Variable names are expected to provide an indication of their purpose.
What you have to submit
1. The pseudo code and flow charts documenting the design of the program. Lecture 4
will give you guidance on this topic. NO C CODE IS WRITTEN AT THIS STAGE.
This should be submitted as a pdf named design.pdf (20%);
2. The testing document. This will provide hand calculations to show that the
calculations in the app are correct. It should also indicate what happens when
erroneous data is entered. For example what happens if not all of the data file is
present or a value is negative. This will be called testing.pdf (20%);
3. Well-documented, syntax-free and correctly-compiling C source code. This should
include, within the comments at the top of the source file, what an example data file
looks like. It should be possible to extract this information, using a text editor, to
Page 5 of 6
3 December 2020
V1
create a data file that allows the app to run. You will be submitting a single file, not
some directory structure generated by an IDE. Name this file program.c (50%);
4. A compliance/summary document. This is the developer showing that the app
produces results that match with the testing document. Also if there are any
conditions when the app is run. This will be called comply.pdf (10%).
Submission Guideline:
Submission will be through Moodle. Submission will be in three parts on three
different dates.
Item Date
Design document, design.pdf 23:00, Sunday 20th of December
Testing Document, testing.pdf 23:00, Sunday 10th of January
Code & compliance, program.c & comply.pdf 23:00, Sunday 24th of January
More information will be provided closer to the day.
Page 6 of 6
3 December 2020
V1
Appendix
Marking Rubric for Programming
Criteria Exceptional
(>=80%)
Acceptable
(between 65%
and 79%)
Amateur
(between 50%
and 64%)
Unsatisfactory
(<50%)
Specifications The program
works and
meets all of the
specifications.
The program
works and
produces the
correct results
and displays
them correctly.
It also meets
most of the
other
specifications.
The program
produces
correct results
but does not
display them
correctly.
The program is
producing
incorrect
results.
Readability The code is
exceptionally
well organized
and very easy
to follow.
The code is
fairly easy to
read.
The code is
readable only
by someone
who knows
what it is
supposed to be
doing.
The code is
poorly
organized and
very difficult to
read
Reusability The code could
be reused as a
whole or each
routine could be
reused.
Most of the
code could be
reused in other
programs.
Some parts of
the code could
be reused in
other programs.
The code is not
organized for
reusability.
Documentatio
n
The
documentation
is well written
and clearly
explains what
the code is
accomplishing
and how.
The
documentation
consists of
embedded
comment and
some simple
header
documentation
that is
somewhat
useful in
understanding
the code.
The
documentation
is simply
comments
embedded in
the code with
some simple
header
comments
separating
routines.
The
documentation
is simply
comments
embedded in
the code and
does not help
the reader
understand the
code.
Delivery The program
was delivered
on time.
The program
was delivered
within a week of
the due date.
The code was
within 2 weeks
of the due date.
The code was
more than 2
weeks overdue.
Efficiency The code is
extremely
efficient without
sacrificing
readability and
understanding.
The code is
fairly efficient
without
sacrificing
readability and
understanding.
The code is
brute force and
unnecessarily
long.
The code is
huge and
appears to be
patched
together.
Source
https://uwf.edu/media/university-of-west-florida/academic-affairs/departments/cutla/documents/
Computer-Programming-Grading-Rubric---California-State-University-Long-Beach.pdf
Marking Rubric for Pseudocode design
Page 7 of 6
3 December 2020
V1
Criteria Exceptional
(>=80%)
Acceptable
(between 65%
and 79%)
Amateur
(between 50%
and 64%)
Unsatisfactory
(<50%)
Algorithm Complete
working
algorithm
created with
strong
supporting
understanding
of the domain
area.
Incomplete
nearly working
algorithm
created with
strong
supporting
understanding
of the domain
area.
Incomplete non
working
algorithm
created with
incomplete
supporting
understanding
of the domain
area.
No working
algorithm
created or no
supporting
understanding
of the domain
area.
Readability Pseudocode is
very clear,
understandable,
readable, and
organised into
as few steps
necessary as
possible.
Pseudocode is
clear,
understandable,
and
the code is
organised
into steps,
though there
may be a few
extra steps.
Pseudocode is
somewhat
understandable,
but
very little of the
code is
organised
logically.
Pseudocode is
difficult to
understand and
is unorganised.
Ability to
convert to a
program
The code can
be easily
converted into
a program.
The code can
be converted
into a program.
The code can
be converted
into a program
only with much
difficulty.
Code cannot be
converted
into a program.
Source
https://www.rcampus.com/rubricshowc.cfm?sp=yes&code=FX2XX4X&
Page 8 of 6
3 December 2020
V1

欢迎咨询51作业君
51作业君 51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: ITCSdaixie