Sunteți pe pagina 1din 3

City University London

School of Engineering and Mathematical Sciences

EE1503 Programming and Design


Coursework Assignment

November 2010
As part of module EE1503 Programming and Design, the students are asked
to complete Coursework assignment which is described in this document.

Problem Definition

Mr Smith works for a local supermarket and has been given a task to collect
the information about the number of chocolate bars the supermarket sells
each day. His manager has asked him to calculate the average number of
chocolates sold per week and for any specified day of the week. You need to
help Mr Smith by producing a computer program which will do the following:

• Collect the quantity of sold chocolate for each day and put these values
into a two-dimensional array choc[i][j], where i identifies the day
of the week and j identifies the week number, starting from week 0.
• Calculate the average quantity of sold chocolates per day and per
week
• Sort the information in the array by descending value – the manager
wants to find out what is the distribution of sold chocolates per day and
per week
• For any new input, the program should return information about the
position in the descending order of that value. For example, if the
sorted values for Mondays for five weeks are:

1230 1120 776 610 456

and a new input of 1200 is produced, the program should inform the
user that the value is second in order for Mondays.

The program should give the following options to the user:

Basic Options:
Option 1: Enter new values
Option 2: Calculate and print averages per day and per week
Option 3: Print the largest number of sold chocolates per day and per
week
(options 1-3 are the minimum for a pass mark in this assignment)
Option 4: Sort the values in descending order per day and per week
Option 5: Give the position of the newly added value in the sorted order
per day

Advanced options:
Option 6: For any input value, the program should identify the days and
the weeks when the number of sold chocolates is bigger that the
input value
Option 7: Assume the first day for which there is a value is 3 November
2010. For any input date, give either the volume of sold
chocolates, or return an error message if there is no value
for that date.
Option 8: Store the array in a text file and update it every time a new
value is added.

Once the user inputs the desired option, the program should call the
appropriate function which will perform the requested task.

Submission and Assessment

The C program should be submitted via Moodle at any time before the
deadline, which is Wednesda y 8 December 2010 . Early
submissions are encouraged.

More information about how to upload the work on Moodle will be available
soon.

Following the submission, the work will be assessed in a short examination in


computer lab, where students will be asked to run their programs and explain
the design and the code.

Important: student s should bring at the examination


flowcharts for all algorithm s used in the program.

The examination will be scheduled later, and will mostly take place in the
period 9-15 December. Early submissions will be examined before that. This
assignment counts as 50% of the overall mark for EE1503.

Pleas e note: the work can be submitted if it is not


complete. Options 6, 7 and 8 are con sidered to be
advanc ed. The minimum required to pas s this
assi gn m ent is to provide solutions for options 1-3.

Students who find the task too challenging should attempt to write programs
which provide only a selection of the Options given above.

Help will be provided during practical sessions but it is essential that each
student develops the solution independently. The examination will focus on
checking the students’ understanding of the submitted code.

Please email me or post comments on Moodle if you have any question with
regard to this Assignment.

Veselin Rakocevic
3 November 2010

S-ar putea să vă placă și