程序代写代做代考 Haskell SCENARIO

SCENARIO

Faculty of Technology – Coursework Specification 2017/18

Module name: Computational Modelling

Module code: CTEC1901

Title of the Assignment: Haskell Coursework

This coursework item is: (delete as appropriate) Summative Formative

This summative coursework will be marked anonymously Yes No

The learning outcomes that are assessed by this coursework are:

4. Apply functional programming techniques.
5. Write functions to perform calculations, process lists and tuples.

This coursework is: (delete as appropriate) Individual Group

If other or mixed … explain here:

This coursework constitutes 25 % of the overall module mark.

Date Set: 12 Feb 2018

Date & Time Due: 09 Mar 2018 16:00

Your marked coursework and feedback will be available to you
on:
If for any reason this is not forthcoming by the due date your module leader will
let you know why and when it can be expected. The Head of Studies

(headofstudies-tec@dmu.ac.uk ) should be informed of any issues relating to
the return of marked coursework and feedback.

Note that you should normally receive feedback on your coursework by no later
than 20 University working days after the formal hand-in date, provided that
you have met the submission deadline.

06 Apr 2018

When completed you are required to submit your coursework via:

1. Upload script file to Blackboard

Late submission of coursework policy: Late submissions will be processed in accordance
with current University regulations which state:
“the time period during which a student may submit a piece of work late without authorisation and
have the work capped at 40% [50% at PG level] if passed is 14 calendar days. Work submitted
unauthorised more than 14 calendar days after the original submission date will receive a mark of 0%.
These regulations apply to a student’s first attempt at coursework. Work submitted late without
authorisation which constitutes reassessment of a previously failed piece of coursework will always
receive a mark of 0%.”
Academic Offences and Bad Academic Practices:
These include plagiarism, cheating, collusion, copying work and reuse of your own work, poor
referencing or the passing off of somebody else’s ideas as your own. If you are in any doubt about
what constitutes an academic offence or bad academic practice you must check with your tutor.
Further information and details of how DSU can support you, if needed, is available at:
http://www.dmu.ac.uk/dmu-students/the-student-gateway/academic-support-office/academic-
offences.aspx and
http://www.dmu.ac.uk/dmu-students/the-student-gateway/academic-support-office/bad-academic-
practice.aspx

Tasks to be undertaken:

Provide a solution for each of the five questions below. You must add a brief
comment for each function explaining how the function works.

mailto:headofstudies-tec@dmu.ac.uk
http://www.dmu.ac.uk/dmu-students/the-student-gateway/academic-support-office/academic-offences.aspx
http://www.dmu.ac.uk/dmu-students/the-student-gateway/academic-support-office/academic-offences.aspx
http://www.dmu.ac.uk/dmu-students/the-student-gateway/academic-support-office/bad-academic-practice.aspx
http://www.dmu.ac.uk/dmu-students/the-student-gateway/academic-support-office/bad-academic-practice.aspx

Question 1 (4 points): Write a function that checks if a given number is a “perfect
number” using a list comprehension. A number x is considered perfect if all of its
factors add up to x, e.g. 6 is perfect because 1 + 2 + 3 = 6. The output should be a
Bool. Include the type signature of the function.

Question 2 (6 points): Write a function that merges two ordered lists of numbers into
one using recursion and pattern matching. The end result should also be ordered.
Include the type signature of the function.

Question 3 (4 points): Write a function that checks if two given student P-numbers
(e.g. “P09876543” and “P17234567”) are from the same year (i.e. they both start
with the same two digits after the initial P). The output should be of type Bool.
Include the type signature of the function.

Question 4 (6 points): Write a function that calculates your tax band based on a
given yearly income using a guarded equation. Your output should be a string.
Include the type signature of the function. You can check the UK’s tax rates on the
government website https://www.gov.uk/income-tax-rates.

Question 5 (5 points)
Write a function, group n xs, that groups a string, xs, into a list of substrings of a size
n. If necessary, the last string may contain fewer than n characters. Thus, group 5
“abcdefghijklm” = [“abcde”, “fghij”, “klm”]

Deliverables to be submitted for assessment:

You are required to submit one Haskell script file. Put all of your code and
comments into a Haskell script (p12345678.hs) (Use your p-number) so that your
entire solution to the assignment can be uploaded as one text file.

How the work will be marked:

Tutors will run each of your solutions using GHCi. Each function will be checked for
correctness. The code comments are really important as these will indicate your
understanding of the code you have written. Your comments will be read by the
marker and checked for understanding. Marks are then assigned for each question.

Module leader/tutor name: David Smallwood / Fania Raczinski

Contact details: fania.raczinski@dmu.ac.uk