ITD121 Programming Principles 代写
100%原创包过,高质代写&免费提供Turnitin报告--24小时客服QQ&微信:120591129
ITD121 Programming Principles 代写
QUTIC 2017 TP1
1
ITD121 Programming Principles
Second Assignment – Problem Solving Task
Annual Rainfall
Weighting 10% - Due date: Week 7, Thursday 13 th April 2017 before midnight
Trivia: The highest annual rainfall recorded in Australia
was at Bellenden Ker in North Queensland in 2000 with
over 12 metres of rain!
[http://www.ga.gov.au/scientific-topics/national-
location-information/dimensions/climatic-extremes]
Specifications
In this assignment you are to implement a program which will report on some simple aspects
of (fictional) rainfall data. The main goal of this assignment is to demonstrate the
manipulation of values stored in an array of arrays, and to use enumeration and Random
variables competently.
Each value stored will represent one day's rainfall (in mm) in a particular month. An array of
arrays (a "jaggered" array) is used (instead of a 2D array) because months don't all have the
same number of days.
Functionality
Your program is to:
randomly generate fictional rainfall data in millimetres (mm) for each day of the year,
according to the following rules:
o the probability of rain falling on any day is 25% (i.e., 1 in 4); and
o on any day when it does rain, less than 28mm will fall;
store that data in the supplied 'jaggered' array representing 12 months, with each month
to be as big as its number of days; (An array populated with the number of days in each
month has been supplied. )
output every day's rainfall total for each month;
on input of a month by the user, output a rainfall report for that month which will consist
of:
o the number of days with no rain, and the number of days with rain;
o the amount of the highest rainfall recorded (on a day) in that month;
o the day of the month that the highest rainfall fell; and
QUTIC 2017 TP1
2
o the average daily rainfall for rainy days for that month (i.e. excluding days with no
rain). This value must be displayed to two (2) decimal places.
See sample screenshots at the end of this document.
Logistics
You are to create a VS project called "Annual Rainfall" and add the near empty .cs which has
been provided as a starting point. You must use this template! Do not change the enum,
array declarations or method headers in any way.
There are two method stubs provided, which must be implemented and used as described in
the XML comments:
public static void LetItRain(int[][] rainfall) {...
public static int CountRainyDays(int[][] rainfall, Months month) {...
Both of these methods must be called by your program.
In order to test your understanding of arrays, loops and conditions, for this assignment you
are not permitted to introduce other data structures or collection types to store the data
other than those in the supplied .cs file. In particular, you are not to use ArrayList or
List<T>. If you are in doubt, please ask one of the teaching staff.
You will need to use two Random variables: one for deciding the likelihood of rain falling on
a particular day and the other for the amount of rain that falls. There are three overloaded
Random methods (Next), each returning a random number in a specific range depending
upon the parameter(s) provided, see examples below:
int number;
number = randomGen.Next(); // 0 <= number < int.MaxValue
number = randomGen.Next(100); // 0 <= number < 100
number = randomGen.Next(1, 100); // 1 <= number < 100
Initially declare a Random variable and supply a 'seed' (an integer parameter) e.g.:
Random amountOfRain = new Random(10);
This ensures that the same random sequence of numbers is produced every time the program
is run. This enables you to check that the logic of your program is correct using the same data
every time. Once you are confident that your program works correctly, you can delete the
seed e.g.:
Random amountOfRain = new Random();
Now every run of your program will produce a different sequence of random numbers
(actually pseudo-random). Note that any integer value can be used as the 'seed'.
Documentation
The class must be preceded by an XML comment containing your full name, student id and a
short overall description of the program. It should be placed between the namespace and
class declarations.
QUTIC 2017 TP1
3
Each method must be preceded by an XML comment describing its purpose.
Note that it is not sufficient to simply generate the XML comments and tags. You must add a
description between each open/end tag pair (e.g. for the summary, param, returns).
Any non-trivial code should also be commented – but only where it adds value to the
readability of your solution.
Assignment Goals
The assignment problem is straightforward. The solution of the problem will be a C# project
consisting of a single class which will use programming constructs covered in Lectures 1 to 4
inclusive. You are free to use any valid C# programming construct, even if it has not been
covered in lectures - except for the goto statement. You must not add any global variables
(i.e. those declared outside methods, at the class level).
Ensure that your code conforms to the Coding Style Guide, available on Blackboard under
"Assessment".
Though the code could be written as straight line code, the sheer number of lines would make
the solution difficult to read, hard to understand, hard to modify and maintain, and much
more likely to contain logical errors. A straight line code solution will not receive full marks
even if it fulfils the required functionality.
As demonstrated in lectures and prac exercises, your Main method should reflect a high level
algorithm for your entire program. The only statements that will be in Main will be calls to
methods which you have written or assignment statements for receiving the returned value
from a method. There are to be NO input or output statements ( (i.e. writing to the screen or
reading from the keyboard) in the body of Main.
You are required to use methods to provide a structure to your solution. Your program should
consist of only one class containing at least five (5) methods (excluding Main and trivial
methods such as ExitProgram and Welcome) as demonstrated in Lecture 2. The
additional methods should be a mixture of value-returning and void methods. There is no
upper limit on the number of methods used.
ITD121 Programming Principles 代写
See the CRA for detailed marking criteria.
Sub-goals of the assignment are to experience:
Top-down design & development
Incremental Development & Incremental Implementation
Translating simple algorithms into C# code
More practice writing user defined methods and parameter passing
The mechanics of editing, compiling (building) and running your program
Random number generation
Writing a program which uses input from the keyboard
Working with array of arrays: storing and accessing data
Building robust solutions
Testing your program
QUTIC 2017 TP1
4
Becoming confident and comfortable with programming in the small
Academic Integrity
This assignment is for individual assessment only. That means the work you submit must be
your own work and not the work of anyone else. You are not permitted to collaborate with
your peers on this assignment, other than to discuss high-level strategies. You are not
permitted to show your code to (or allow your code to be seen by) another student, or to look
at another student's code. You are not permitted to ask or commission someone else to write
the assignment for you (including on-line sources), or help you write the assignment. If you
are struggling to complete the assignment yourself, please see one of the teaching staff in
consultation as soon as possible, or talk to them in class.
If you are in any doubt as to what is permitted and what is considered a breach of academic
integrity, please ask. QUT treats breaches of academic integrity very seriously, and being
guilty of same is likely to have consequences that adversely affect the remainder of your
academic career.
Electronic Submission
You will submit your assignment via the link in the Assessment folder on Blackboard (BB)
before 11.59 pm on the due date. You can submit as many times as you like up to the
deadline. Your last submission prior to the deadline will be marked.
It is recommended that you upload your file to Blackboard from a workstation at QUTIC.
Inability to access Blackboard from home is not a sufficient reason for submitting the
assignment late or requesting an extension.
Plan to be finished well before the afternoon of the due date! You should avoid writing all of
the code in one sitting and then attempt a build (compilation). Remember Incremental
Development and Incremental Implementation.
Final Comments
You must use the supplied .cs file as the starting point of your project. You must not change
any of the supplied code. The code compiles successfully and runs albeit with no functionality.
You should ensure that your project always compiles and does something.
This assignment is not about screen design so do not waste time attempting to produce fancy
screen output. However, you are free to alter and enrich the output statements, though it
will not gain any additional marks.
Hope you enjoy the challenge of working with arrays!
QUTIC 2017 TP1
5
APPENDIX – sample output
Figure 1: The data randomly generated for each day of each month of the year is displayed,
under the provided heading (so it's easy to read!). Some days have 0 rain, and other days
have some rain, displayed in millimetres. Each month has the correct number of days.
Figure 2: The user has entered "12", and the statistical information is then displayed for the
12 th month, i.e. December.
ITD121 Programming Principles 代写