[go: up one dir, main page]

0% found this document useful (0 votes)
49 views7 pages

ProgPrinc (CSP1150) Assignment 250

Uploaded by

hewagemax1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views7 pages

ProgPrinc (CSP1150) Assignment 250

Uploaded by

hewagemax1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Programming Principles (CSP1150)

Assignment: Individual programming assignment (“Rhythm Test” program)


Assignment Marks: Marked out of 20, worth 20% of unit
Due Date: 30 December 2024, 9:00AM

A Message Regarding Academic Integrity

In recent semesters this unit has experienced academic misconduct, including seeking or paying for
solutions online, using the work of other CSP1150 students, generating code using AI, and working
on individual assessments with other students. These incidents have resulted in students receiving
zero marks for the assessment or entire unit, suspensions, and even expulsion from the university.

If you start your assignments in a timely fashion, engage with the unit content, and regularly seek
help and feedback from unit staff and ECU learning support staff, these issues will not apply to you.

Background Information
This assignment tests your understanding of and ability to apply the programming concepts we have
covered in the unit so far, including the usage of variables, input and output, data types and structures,
selection, iteration and functions. Above all else, it tests your ability to design and then implement a
solution to a problem using these concepts.

Contact your tutor if you have questions or do not understand any part of the assignment, or if you
would like help or feedback on your work. You should do this at least once prior to submission.

Assignment Overview
You are required to design and implement a program that allows the user to complete a rhythm test,
seeing how consistent their timing is when pressing Enter. The user can select the speed of the rhythm
and the number of rounds at the start of the program, and after the final round the program displays
a summary and breakdown of their results.

Details of the program requirements can be found in the “Program Requirements” section.

The entirety of this program can be implemented in under 110 lines of code (although implementing
optional additions may result in a longer program). This number is not a limit or a goal – it is based
upon an average quality implementation that includes comments and blank lines. It is simply provided
to prompt you to ask your tutor for advice if your program significantly exceeds it.

Tip: You can (and should) make a start on this assignment as early as the end of Week 2.

When starting out with programming, it is common to encounter difficulties that temporarily slow
or stop your progress. The sooner you start, the more time you have to work through difficulties.

Summer School, 2025 CSP1150 Assignment Page 1


Program Output Example
To help you visualise the program, here is an example screenshot of the program being run:

In this example, the user first enters invalid input of “hello” when prompted for a rhythm speed (simply
to demonstrate that the program validates the input it receives), before entering 1 and choosing 5
rounds. The program confirms the details of the test and waits for the user to press Enter to begin.

Once the user presses enter, the program goes through 5 rounds, waiting for the user to press Enter
each time. They are told their response time and a rating each round. After the final round, their
results are shown, including a round-by-round breakdown.

Summer School, 2025 CSP1150 Assignment Page 2


Pseudocode
As emphasised by the case study of Module 5, it is important to take the time to properly design a
solution before starting to write code. Hence, this assignment requires you to write and submit
pseudocode of your program design as well as the code for the program. Furthermore, while your
tutors are happy to provide help and feedback on your assignment work throughout the semester,
they will expect you to be able to show your pseudocode and explain the design of your code.

You will gain a lot more benefit from pseudocode if you actually attempt it before trying to code your
program – even if you just start with a rough draft to establish the overall program structure or a single
section of the program, and then revise and expand it as you work on the code. This back-and-forth
cycle of designing and coding is completely normal and expected, particularly when you are new to
programming. The requirements detailed on the following pages should give you a good idea of the
structure of the program, allowing you to make a start on designing your solution in pseudocode.

See Reading 3.3 and the Rubric and Marking Criteria document for guidance regarding pseudocode.

Write a separate section of pseudocode for each function you define in your program so that the
pseudocode for the main part of your program is not cluttered with function definitions. Ensure that
the pseudocode for each of your functions clearly describes any parameters that the function receives
and what the function returns back to the program. Pseudocode for functions should be presented
after the pseudocode for the main part of your program.

It may help to think of the pseudocode of your program as the content of a book, and the pseudocode
of functions as its appendices: It should be possible to read and understand a book without necessarily
reading the appendices, however they are there for further reference if needed.

Only one function is required in this assignment (detailed later in the assignment brief).

Tip: Do not attempt to implement the entire program at once. Work on one small part (a single
requirement or even just part of a requirement) and only continue to another part once you have
made sure that the previous part is working as intended and that you understand it.

It can also be useful to create separate little programs to work on or test small sections of code.
This allows you to focus on just that part without the rest of the program getting in the way,
and allows you to work on a section without necessarily having completed prior/other sections.

Summer School, 2025 CSP1150 Assignment Page 3


Program Requirements
In the following information, numbered points describe a core requirement of the program, and bullet
points (in italics) are additional details, notes and hints regarding the requirement. Ask your tutor if
you do not understand the requirements or would like further information.

1. Print messages welcoming the user and explaining how the program works, then prompt them to
choose a rhythm speed (1, 2 or 3) and number of rounds (5 to 50). Use loops to re-prompt the
user until they enter valid responses, and display error messages if they enter something invalid.
▪ Store the two numbers as integers. This brief will refer to the variables as “speed” and “rounds”.
▪ Determining whether the user’s input is valid can be approached in various ways. The program should
not crash if the user enters invalid values such as letters or floating-point numbers.

2. Print a message confirming the rhythm speed and number of rounds and use the “input()”
function to display a “Press Enter to begin” message. Immediately following this, record the
current timestamp.
▪ The input() function is used here (and in Requirements 3.1 and 4) simply to make the program wait
until the user presses Enter. There is no need to assign the input to a variable in this case.
▪ The “time.time()” function returns the current timestamp as a float (in seconds, with decimal
places). By recording it as soon as the user presses Enter, you capture the time that they start the test.

3. Enter a loop that repeats rounds times… Before the loop, print “Initialising rhythm test!”
3.1. Print which round the user is up to out of the total number of rounds, e.g. “Round 1 of 10”
and then wait for the user’s input. Immediately following this, record the current timestamp.

3.2. Calculate the user’s response time by subtracting the current round’s timestamp from that
of the start of the test/the previous round, and display it to the user alongside a rating
determined by calling the “rate_rhythm()” function (Page 5).
▪ Round all response times (and the “difference” values in Requirement 5) to two decimal places.
This will make them easier to display and avoid unexpected issues with floating-point values.
▪ Remember to keep track of this round’s timestamp so that you can use it to calculate the next
round’s response time. Think through and plan out your use of variables within/before the loop!

4. After all the rounds have completed, the loop from Requirement 3 ends, print “Test Complete!
Press Enter to see your results.” When the user presses Enter, display their fastest response time,
average (mean) response time, and slowest response time, alongside the rating for each.
▪ Implementing this (and Requirement 5) involves adding code to earlier parts of the program to keep
track of information as the user progresses through the rounds, e.g. A list that starts out empty before
the loop and has each round’s response time added to it during the loop.
▪ Use the rate_rhythm() function (Page 5) to determine the ratings.

5. Finally, display a round-by-round breakdown of the test (as pictured on Page 2) that includes the
round number, response time and difference (including whether it was early/late) of each round.
▪ If the user responded at exactly the right time, print “Spot on!” instead of the difference.
▪ The difference should be an absolute value (always positive), e.g. the difference would be 0.15 if speed
was 1 and response time was 0.85 or 1.15. The “abs()” function returns the absolute value of a value.

Summer School, 2025 CSP1150 Assignment Page 4


The “rate_rhythm” Function
You must create a function named “rate_rhythm()” and use when implementing Requirements
3.2 and 4. The definition of the function should be at the start of the program, and it should be called
where needed in the program. The function requires two parameters – “target_time” (this will
always be the speed of the current test) and “actual_time”.
% Difference Rating
The function should return a string of “Great!” if actual_time <= 8% Great!
is within 8% of target_time, “Okay!” if it is within 16%, or <= 16% Okay!
“Miss!” otherwise (more than 16% away). > 16% Miss!

For example, rate_rhythm(1, 1.08) would return “Great!”, rate_rhythm(2, 1.71)


would return “Okay!” and rate_rhythm(3, 3.54) would return “Miss!”. Remember that the
rating should be based upon the percentage difference. The function should not reference any global
variables or print anything itself. Revise Module 4 if you are uncertain about these concepts.

Ensure that the function does exactly what is specified above and nothing more – it is important to
adhere to the stated specifications of a function, and deviating from them will impact your marks. If
you are thinking of creating additional functions in your program, please consult with your tutor.
Creating functions that add to the complexity of a program without benefiting it is a common issue.

Tip: Check the Discussions on the unit site on a regular basis – extra tips, examples and advice
regarding the assignment will be posted there throughout the semester. You are also welcome to
make your own posts if you have questions – but don’t upload your work to the discussion board!

Email your work to your tutor at least once while working on your assignment, so that they can give
you advice and feedback on it. This will definitely help you to improve your work (and your mark)!

Summer School, 2025 CSP1150 Assignment Page 5


Optional Additions and Enhancements
Below are some suggestions for minor additions and enhancements that you can make to the program
to further test and demonstrate your programming ability. They are not required and you can earn
full marks in the assignment without implementing them.

▪ Allow the user to input “x” during the test to end it prematurely, skipping remaining rounds
and going to the results (do not include the round where “x” was entered in the results). Be
sure to mention this feature before the test starts, and account for the possibility of the user
entering “x” in the first round.

▪ Alongside the average response time in the results, show median response time (and rating).

▪ Make sure that the program’s output is always well presented – display time values with two
decimal places and a “s” for seconds, and make sure the columns of the row-by-row
breakdown always line up.

▪ At the end of the results, print “Your rhythm is usually too fast.” or “Your rhythm is usually
too slow.” depending on whether they responded too fast or slow in most rounds of the test.

▪ After displaying the results, ask the user if they would like to start again. If they enter “y” or
“yes”, return to the start of the program. Otherwise, end the program.

Summer School, 2025 CSP1150 Assignment Page 6


Submission of Deliverables
It is strongly recommended that you send your work to your tutor for feedback at least once prior to
submitting it. Once your assignment is complete, submit both your pseudocode (in PDF format) and
source code (“.py” file) to the appropriate location in the Assignments area of the unit site. Be sure
to include your name and student number at the top of both files (not just in the filenames).

Academic Integrity and Misconduct


The entirety of your assignment must be your own work (unless otherwise referenced) and produced
for the current instance of the unit. Any unreferenced content you did not create is academic
misconduct (plagiarism). Assignments are submitted to plagiarism checking software which includes
previous assignments, and the work submitted by all students in the unit. Submissions are also
manually compared and checked. Do not make your work available online, during or after the unit.

Remember that this is an individual assignment. Never give anyone any part of your assignment –
even after the due date or after results have been released. Do not work together with other students
on individual assignments – you can help someone by explaining a concept or directing them to the
relevant resources, but doing any part of the assignment for them or alongside them, or showing them
your work, is inappropriate. An unacceptable level of cooperation between students on an assignment
is academic misconduct (collusion). Using AI tools (e.g., ChatGPT) is also inappropriate for assignment
work. If you are having trouble with your assignment, please talk to/email your tutor. If you are
uncertain about plagiarism, collusion or referencing, simply ask unit staff.

You may be asked to explain and demonstrate your understanding of the work you have submitted.
Your submission should accurately reflect your understanding and ability to apply the unit content.

Marking Key
Criteria Marks
Pseudocode
These marks are awarded for submitting pseudocode which suitably represents the design of 5
your source code. Pseudocode will be assessed based on whether it clearly describes the steps
of the program in English, and whether the program is well structured.
Functionality
These marks are awarded for submitting source code that implements the requirements 10
specified in this brief, in Python 3. Code which is not functional or contains syntax errors will
lose marks, as will failing to implement requirements/functions as specified.
Code Quality
These marks are awarded for submitting well-written source code that is efficient, well- 5
formatted and demonstrates a solid understanding of the concepts involved. This includes
appropriate use of commenting and adhering to best practise.

Total: 20

See the “Rubric and Marking Criteria” document provided with this brief for further details!

Summer School, 2025 CSP1150 Assignment Page 7

You might also like