首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CMT120代做、Python/Java设计程序代写
项目预算:
开发周期:
发布时间:
要求地区:
Cardiff School of Computer Science and Informatics
Coursework Assessment Pro-forma
Module Code: CMT120
Module Title: Fundamentals of Programming
Lecturers: Federico Liberatore
Assessment Title: Programming Challenges
Date Set: 23rd October 2023
Submission date and Time: 14th December 2023 at 9:30AM
Return Date: 15th January 2024
If you have been granted an extension for Extenuating Circumstances, then the submission deadline and return date will be
later than that stated above. You will be advised of your revised
submission deadline when/if your extension is approved.
If you defer an Autumn or Spring semester assessment, you
may fail a module and have to resit the failed or deferred components.
If you have been granted a deferral for Extenuating Circumstances, then you will be assessed in the next scheduled assessment
period in which assessment for this module is carried out.
If you have deferred an Autumn or Spring assessment and are
eligible to undertake summer resits, you will complete the deferred
assessment in the summer resit period.
If you are required to repeat the year or have deferred an assessment in the resit period, you will complete the assessment in
the next academic year.
As a general rule, students can only resit 60 failed credits in
the summer assessment period (see section 3.4 of the academic
regulations). Those with more than 60 failed credits (and no more
than 100 credits for undergraduate programmes and 105 credits
for postgraduate programmes) will be required to repeat the year.
There are some exceptions to this rule and they are applied on a
case-by-case basis at the exam board.
If you are an MSc student, please note that deferring assessments may impact the start date of your dissertation. This is
1
because you must pass all taught modules before you can begin
your dissertation. If you are an overseas student, any delay may
have consequences for your visa, especially if it is your intention
to apply for a post study work visa after the completion of your
programme.
NOTE: The summer resit period is short and support from
staff will be minimal. Therefore, if the number of assessments is
high, this can be an intense period of work.
This assignment is worth 40% of the total marks available for this module. If coursework is submitted late (and where there are no extenuating
circumstances):
1. If the assessment is submitted no later than 24 hours after the deadline,
the mark for the assessment will be capped at the minimum pass mark;
2. If the assessment is submitted more than 24 hours after the deadline,
a mark of 0 will be given for the assessment.
Extensions to the coursework submission date can only be requested
using the Extenuating Circumstances procedure. Only students with approved extenuating circumstances may use the extenuating circumstances
submission deadline. Any coursework submitted after the initial submission
deadline without approved extenuating circumstances will be treated as
late.
More information on the extenuating circumstances procedure can be
found on the Intranet:
https://intranet.cardiff.ac.uk/students/study/exams-and-assessment/
extenuating-circumstances
https://intranet.cardiff.ac.uk/students/study/your-rights-and-responsibilities/
academic-regulations
By submitting this assignment you are accepting the terms of the following declaration:
2
I hereby declare that my submission (or my contribution to it in the
case of group submissions) is all my own work, that it has not previously
been submitted for assessment and that I have not knowingly allowed it to
be copied by another student. I declare that I have not made unauthorised
use of AI chatbots or tools to complete this work, except where permitted. I
understand that deceiving or attempting to deceive examiners by passing off
the work of another writer, as one’s own is plagiarism. I also understand
that plagiarising another’s work or knowingly allowing another student to
plagiarise from my work is against the University regulations and that doing
so will result in loss of marks and possible disciplinary proceedings.
3
Assignment
To complete this coursework, you must complete a set of programming challenges in Python and JavaScript.
Each challenge can be awarded a maximum of 10 marks. Therefore,
perfectly solving five exercises will give you 50 marks (pass), and perfectly
solving all the exercises will give you 100 marks. An exercise is solved perfectly only if high-quality functional code is submitted in both Python and
JavaScript. Providing high-quality functional code in only one programming
language results in a lower mark (i.e., five marks out of ten). Therefore, you
can still pass the coursework by only completing problems in one language,
or by completing half the problems in both languages.
You might not be able to solve all the exercises. This is fine. You are
not all expected to be able to solve all of the challenges in both languages.
However, you should be able to solve enough of the exercises in one or both
languages to be able to pass the assessment and demonstrate you have met
the learning outcomes being assessed.
The challenges are described in detail below, and you are also provided
with a set of test cases that will check whether your code produces the
required output or not. In particular, you will be given two test cases per
exercise. You should make sure that your submitted code passes the supplied
tests to ensure it functions correctly. However, please note that your code
will be tested against a further two different test cases, which you have not
been supplied with. In total then each exercise will be tested against four
test cases, including the two provided. You should therefore ensure that you
try to cover all possible inputs and that your code still functions correctly.
Your code will need to pass all 4 tests (2 seen, 2 unseen) in order to score
full marks for the functionality. Note that there is a time limit of 3 seconds
to each test. If your code does not provide a correct answer within the time
limit the test is failed.
Instructions for completing the challenges
• You will find template code for the assignment on Learning Central.
This provides two folders, python and js. Inside each folder you
will find a template.{js/py} file, in which you should complete your
solutions. You will also find a test_template.{js/py} file containing
the test cases that will check your code’s functionality, along with a
folder of test data required for some of the tests. You are also supplied
4
with a Readme.md file containing detailed instructions on how to run
the test cases to check your code.
• In the templates, the functions’ interfaces are given but the functions’
bodies are empty. Solve the exercises by correctly filling in the functions’ bodies.
• It is forbidden to change the functions’ interfaces. However, new
functions can be defined to support the solution of the exercises.
These functions must have names that are different from those already
present in the templates.
• You are NOT allowed to import any additional modules. Use of module functions will result in zero marks for the corresponding exercises.
• In all the exercises, you can assume that the inputs are provided in the
appropriate format and type. Therefore, error-checking is not needed.
• The final submission should NOT contain any input, print, or console.log
statements.
You will be given marks for solving each problem in both programming
languages within the time limit. Further marks will be awarded for solution
style and quality. The mark scheme is described in further detail later.
Exercise 1: Smallest Fraction Terms
Complete the function ‘exercise1’ that takes two positive integers as its
parameters. The parameters represent the numerator and denominator of a
fraction. The function reduces the fraction to lowest terms and then returns
both the numerator and the denominator of the reduced fraction as integers.
Python: The numerator and denominator should be returned as a tuple.
JavaScript: The numerator and denominator should be returned as
elements 0 and 1 of a 2-item array.
Examples:
• exercise1(12,15) returns (4, 5) in Python and [4,5] in JavaScript.
• exercise1(8,4) returns (2,1) in Python and [2,1] in JavaScript.
5
Exercise 2: Magical Dates
A magic date is a date where the day multiplied by the month is equal to
the last two digits of the year.
For example 10/6/1960 is a magic date because 6 times 10 is 60, which
is equal to the last two digits of 1960.
Complete the function ‘exercise2’ that takes three positive integers as its
parameters, day, month, and year, respectively, and returns True if the date
is a magic date, or False otherwise.
Examples:
• exercise2(10,6,1960) returns True in Python and true in JavaScript.
• exercise2(10,6,1970) returns False in Python and false in JavaScript.
Exercise 3: Find All Sublists
A sublist is a list that constitutes a portion of a larger list. A sublist can
consist of a single element, multiple elements, or no elements at all.
Example: [1], [2], [3] and [4] are all sublists of [1, 2, 3, 4]. The
list [2, 3] is also a sublist of [1, 2, 3, 4], but [2, 4] is not a sublist of
[1, 2, 3, 4] because the elements 2 and 4 are not adjacent in the longer
list. The empty list is a sublist of any list. As a result, [] is a sublist of
[1, 2, 3, 4]. A list is a sublist of itself, meaning that [1, 2, 3, 4] is
also a sublist of [1, 2, 3, 4].
Using the above definition of a sublist, complete the function ‘exercise3’
that takes a list as its only parameter, and returns a list containing every
possible sublist of the input list.
Examples:
• exercise3([1,2,3,4]) returns
[[],[1],[2],[3],[4],[1,2],[2,3],[3,4],[1,2,3],[2,3,4],[1,2,3,4]].
• exercise3([’a’,2,(0,"zero")]) returns
[[],[’a’],[2],[(0,"zero")],[’a’, 2],[2, (0,"zero")],[’a’, 2, (0,"zero")]].
The order of the elements of the list returned is not important. However,
the order of the elements inside of each list should reflect the order in the
original list. For example, [’a’, 2] is correct, while [2, ’a’] is not.
6
Exercise 4: English to Pig Latin Translator
Pig Latin is a language game or argot in which English words are altered,
usually by adding a fabricated suffix or by moving the onset or initial consonant or consonant cluster of a word to the end of the word and adding a
vocalic syllable to create such a suffix (Wikipedia).
The following rules are used to translate English into Pig Latin:
• If the word begins with a consonant (including ‘y’), then all letters at
the beginning of the word, up to the first vowel (excluding ‘y’), are
removed and then added to the end of the word, followed by ‘ay’.
Example: ‘computer’ becomes ‘omputercay’ and ‘think’ becomes ‘inkthay’.
• If the word begins with a vowel (not including ‘y’), then ‘way’ is added
to the end of the word.
Example: ‘algorithm’ becomes ‘algorithmway’ and ‘office’ becomes
‘officeway’.
Complete the function ‘exercise4’ that takes a string as the only parameter and return a string representing its Pig Latin translation.
Examples:
• exercise4(‘algorithm’) returns ‘algorithmway’.
• exercise4(‘computer’) returns ‘omputercay’.
The function should correctly handle uppercase letters and punctuation
marks such as commas, periods, question marks and exclamation marks.
You can assume that only the first letter can be uppercase and that punctuation marks can only be at the end of the word.
Example: if an English word begins with an uppercase letter, then
its Pig Latin representation should also begin with an uppercase letter and
the uppercase letter moved to the end of the word should be changed to
lowercase. For example, ‘Computer’ should become ‘Omputercay’. If a
word ends in a punctuation mark, then the punctuation mark should remain
at the end of the word after the transformation has been performed. For
example, ‘Science!’ should become ‘Iencescay!’.
Exercise 5: Morse Code Encoder
Morse code is a method used in telecommunication to encode text characters
as standardized sequences of two different signal durations, called dots and
7
dashes (or dits and dahs). Morse code is named after Samuel Morse, an
inventor of the telegraph (Wikipedia).
Complete the function ‘exercise5’ that takes a string of letters and numbers as the only parameter and returns a string with its Morse code representation.
Use a period ‘.’ to represent a dot, and a minus sign ‘-’ to represent a
dash. The mapping from letters and numbers to dashes and dots is illustrated in the following figure.
The function should leave a single space between each sequence of dashes
and dots and it should ignore any characters that are not letters or numbers.
Example:
• exercise5(‘Hello, World!’) returns ‘.... . .-.. .-.. --- .-- --- .-. .-.. -..’.
• exercise4(‘Dracarys!!!!’) returns ‘-.. .-. .- -.-. .- .-. -.-- ...’.
Hint: use dictionaries to represent the Morse code table.
Exercise 6: Spelling Out Numbers
Complete the function ‘exercise6’ that takes an integer between 0 and 999
as its only parameter, and returns a string containing the English words for
that number.
• exercise6(21) returns ‘twenty-one’.
• exercise6(191) returns ‘a hundred and ninety-one’.
Hint: Use one or more dictionaries to implement your solution rather
than large if/elif/else constructs.
8
Exercise 7: No Functions without Comments
Complete the function ‘exercise7’ that takes a string containing a filename
as its only parameter. The filename should be a source file. The function
reads the file, identifies functions that are not immediately preceded by a
comment and returns a list of their name (represented as strings).
Python: For the purposes of this exercise, assume that any line that
begins with ‘def’, followed by a space, is the beginning of a function definition. Also, assume that, when the function has a comment, the comment
character, ‘#’, will be the first character on the previous line.
JavaScript: For the purposes of this exercise, assume that any line that
begins with ‘function’, followed by a space, is the beginning of a function
definition. Also, assume that, when the function has a comment, the singleline comment symbol, ‘//’, will be the first character on the previous line.
Exercise 8: Justify any Text
Complete the function ‘exercise8’ taking two parameters, a filename, and
a maximum length (i.e., a strictly positive integer number). The function
opens the file, reads every line, and returns a list of strings where every
string represents a line that is filled as much as possible without exceeding
the given maximum length.
Example: consider a file containing the following lines from ‘Alice’s
Adventures in Wonderland’.
Alice was
beginning to get very tired of sitting by her
sister
on the bank, and of having nothing to do: once
or twice she had peeped into the book her sister
was reading, but it had
no
pictures or conversations in it,"and what is
the use of a book," thought Alice, "without
pictures or conversations?"
The corresponding output for length = 50 would be:
[’Alice was beginning to get very tired of sitting’,
’by her sister on the bank, and of having nothing’,
’to do: once or twice she had peeped into the book’,
9
’her sister was reading, but it had no pictures or’,
’conversations in it, "and what is the use of a’,
’book," thought Alice, "without pictures or’,
’conversations?"’]
You do not need to deal with multiple paragraphs of text. That is,
you can group together words from different paragraphs. Finally, you can
assume that no word is longer than the maximum length.
Exercise 9: Knight’s Challenge
Complete the function ‘exercise9’ that takes three parameters: an initial
position, a final position, and a number of moves. The function returns
True if a knight on an empty chessboard can get to the final position from
the starting position in at most the given number of moves; otherwise, the
function returns False. Useful facts:
• A chessboard is an 8x8 square board.
• Each cell of the chessboard is identified by its coordinates: a letter
from ‘a’ to ‘h’ that identifies the column, and a number from 1 to 8
that identifies the row. The positions are provided to the functions
using this format.
• The chessboard contains only the knight, which is located at the specified initial position.
• A knight may move two squares vertically and one square horizontally,
or two squares horizontally and one square vertically.
Examples:
• exercise9(’a1’, ’c5’, 2) returns True.
• exercise9(’c6’, ’h1’, 1) returns False.
Hint: You may want to use recursion.
Exercise 10: War of Species
Complete the function ‘exercise10’ that takes as input a list of strings of
the same length, representing a rectangle grid. The characters in the list
represent the cells of the grid. The cells can take three possible values:
10
• ’X’, representing an individual of the species X.
• ’O’, representing an individual of the species O.
• ’.’, representing an empty cell.
Example:
["X.......", "........", ".......O"]
is a 3x8 grid with an ’X’ in position (1,1) and a ’O’ in position (3,8).
The configuration provided in the list represents the current state of an
environment with two competing species. Every cell interacts with its eight
neighbours, which are the cells that are horizontally, vertically, or diagonally
adjacent. The function should return a list of strings representing the next
state of the environment according to the following rules:
• An empty cell becomes non-empty if it is surrounded by at least two
individuals of the same species. In particular, it becomes an individual
of the most frequent species in its neighbourhood. In case of a draw
between the species, the cell remains empty.
• A non-empty cell becomes empty if it is surrounded by more than six
non-empty cells, regardless of their species.
• A non-empty cell becomes empty if it is surrounded by less than three
members of its species.
• A non-empty cell becomes empty if it is surrounded by more members
of the opposite species than members of its species.
• In any other circumstances, a cell does not change its value.
You can assume that the format of the input list of strings is correct.
Example: The initial environment
["XX......", "XX....O.", ".....OOO"]
becomes
["XXX.....", "XXX..OOO", "XX....O."]
11
Learning Outcomes Assessed
• LO1: Use high-level programming languages to complete programming
tasks.
• LO2: Demonstrate familiarity with programming concepts, simple
data-structures and algorithms.
Criteria for assessment
Credit will be awarded against the following criteria.
Each exercise can be awarded a maximum of 10 marks. Therefore, perfectly solving five exercises will give you 50 marks (pass), and perfectly
solving ten exercises will give you 100 marks.
Each exercise is marked for both function (8 marks max) and style/quality
(2 marks max). Exercises that are not a real attempt at solving the problem
presented will receive zero marks.
Functionality [8 marks/exercise max] The functional part of the submission is automatically marked by scripts that run the completed function
against a set of test cases. You will be provided with two test cases per exercise. During marking, each exercise will be tested against four test cases,
including the two provided. A test should take less than three seconds to
complete, otherwise, it is considered failed. For each language (Python and
JavaScript) and exercise, passing one test will award you 1 mark. Therefore,
the maximum functionality mark of 8 will be given only if all the tests are
passed in both languages.
Code quality and style [2 marks/exercise max] Each version of the
exercise (i.e., Python and JavaScript) is assessed independently, according
to the following criteria:
12
High quality and style (50-100%,
0.5-1 marks per exercise)
Low quality and style (0-50%, 0-0.5
marks per exercise)
Code is elegant
Code has no redundancies
Code is well commented
Code is perfectly modular (i.e.,
appropriate functions and/or classes
defined)
Code makes smart use of built-in
language features and classes.
Code is messy or overly verbose
Code has multiple redundancies and
repetitions
Code is lacking in meaningful
comments
Code is disorganised
Code does not make use of language
features
Therefore, an exercise solved in only one language could achieve at most
one of the style/quality marks. To obtain both marks, the exercise must be
solved in both languages. Also, only exercises that pass at least two tests
are evaluated for style and quality.
Feedback and suggestion for future learning
Feedback on your coursework will address the above criteria. Feedback and
marks will be returned on the return date via Learning Central and/or email.
The feedback from this assignment will be useful for your second programming assignment, and will also be relevant for any future programming
tasks.
Submission Instructions
All coursework should be submitted via upload to Learning Central.
Description Type Name
Python Code 1 .py file [Student number].py
JavaScript Code 1 .js file [Student number].js
Replace [Student number] with your Cardiff’s user name, which is typically a letter ’c’ (or ’d’) + your student number, e.g. c1234567.
Any code submitted will be run on a system equivalent to the laptops
provided to the students, and must be submitted as stipulated in the instructions above. The code should run without any changes being required
to the submitted code, including editing of filenames.
13
Any deviation from the submission instructions above (including the
number and types of files submitted) may result in a deduction of up to
10% from the overall mark.
Staff reserve the right to invite students to a meeting to discuss coursework submissions.
Support for assessment
Questions about the assessment can be asked on https://stackoverflow.com/c/comsc/
and tagged with ‘[CMT120]’, during Tutorial lectures in Weeks 3-11, and
in the Drop-in Practical Support sessions. It is important to notice that
only general guidance will be provided. The tasks of solving the exercises,
defining the logic and debugging the code (among others) are the key focus
of the assessment and therefore a responsibility of the students.
14
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!