关键词 > CP1401/CP5639

CP1401/CP5639 SP51 2023 Assignment 1

发布时间:2023-04-22

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CP1401/CP5639 SP51 2023 Assignment 1

Task:

For this assessment, you are to plan (using pseudocode) and then implement 3 separate programs in Python 3. This assignment is designed to help you build skills using:

1.  Pizza Pay Calculator: Input, Processing and Output

2.  Device Time Determinator: Decision structures

3.  Hiking Tracker: Repetition structures

Do not use any code constructs (e.g., lists, files, defining your own functions) that have not been taught in the subject up to this point. 100% of what you need to know to complete this assignment successfully is taught in the lectures and practicals. Ask yourself, "where have we done this before?"

Each program should be written in a separate Python file with the prescribed file name.

Each file should follow the structure provided in the example below. That is, each file should start with a module docstring comment at the very top containing your details and your pseudocode, then your  solution code should follow. Replace the parts in , which are there to show you where to

put your details and work.

Example for program 1:

"""

CP1401 2023 TR1 Assignment 1

Program 1 Pizza Pay Calculator

Name: name>

Date started:

Pseudocode:

here>

"""

print("...")

Requirements and Expectations:

1.  We encourage you to work incrementally on these tasks: focus on completing small parts at a time rather than trying to get everything done at once.

2.  Sample output from the programs is provided with each program description.

Ensure that your programs match these, including spacing, spelling, etc. Think of this as helpful guidance as well as training you to pay attention to detail. The sample output is             intended to show a full range of situations so you know how the programs should work.

3.  You do not need to handle incorrect types in user input. E.g., if the user is asked for the      number of minutes and enters "none" instead of an integer, your program should just crash. That's fine.

4.  Make use of named constants as appropriate, e.g., for things that would otherwise be "magic numbers".See our guide for guidelines about choosing constants.

5.  You are expected to include appropriate comments in each of your programs (not just the module docstring). Use # block comments on their own line for things that might reasonably     need a comment.Use comments as you have been taught and is summarised in our guide. Do not include unnecessary "noise" comments.

6.  Check the rubric below carefully to understand how you will be assessed. There should be no surprises here this is about following the best practices we have taught in the subject.

Program 1 Pizza Pay Calculator

Learning outcome focus: Input, Processing, Output

File name: a1_1_pizza_pay_calculator.py

Warm Pizza is a new company revolutionising the pizza home delivery experience by paying its drivers by the trip and minute.

(The faster drivers go, the more trips they can do, but the fewer minutes they get paid for. Interesting...) This program is a simple calculator for pizza delivery drivers to calculate their pay for a shift based on how many trips they do and how long they drive for.

Warm Pizza pays $1.45 per trip and $0.95 per minute.

Note: there is no looping or error-checking in this program.

The sample output below shows the currency values displayed with two decimal places, which your program should also do.

Sample Output from 2 different runs:

It should be clear what parts of the samples are user input for all samples in this document.

E.g., in the first example below, the user entered 17 and 2. All of the other parts of the sample were printed by the program.

Warm Pizza Pay Calculator

Number of trips: 17

Number of minutes: 2

For 17 trips, your pay is: $24.65

For 2 minutes, your pay is: $1.90

Your total pay is $26.55

Warm Pizza Pay Calculator

Number of trips: 7

Number of minutes: 93

For 7 trips, your pay is: $10.15

For 93 minutes, your pay is: $88.35

Your total pay is $98.50

Program 2 Device Time Determinator

Learning outcome focus: Decision Structures

File name: a1_2_device_time.py

A youngster's device time is allocated based on their number of music practices and whether they mow the lawn.

If they mow, then device time is allocated at 15 minutes per practice.

There's a special cupcake bonus if the youngster does at least 7 practices.

If they do not mow, then they do not get device time or a cupcake :(

The user should be able to enter "yes" in any capitalisation (see examples below) to indicate that they did mow the lawn.

Note: there is no looping or error-checking in this program.

Sample Output from 3 different runs:

Device Time Determinator

Number of practices: 8

Did you mow? no

No device time :(

Device Time Determinator

Number of practices: 3

Did you mow? yes

You get 45 minutes of device time :)

Device Time Determinator

Number of practices: 7

Did you mow? YES

You get 105 minutes of device time :)

And you get a cupcake!

Program 3 Hiking Tracker

Learning outcome focus: Repetition Structures

File name: a1_3_hiking.py

This program helps hikers keep track of how far they have walked per day.

Hikers will be asked for the number of days, then the distance hiked for each of those days.

When this is entered, the program will tell them the total and average distance as well as whether their last day was above/below/equal to the average distance.

Number of days and each distance must be error checked following the pattern you have been taught . There is no maximum number of days, but the minimum is 1.

The daily distance must be between 0 and 120 inclusive.

Suggestion: One good way to approach this question is to design it and get it working without the error-checking, then add the error-checking, one section one at a time.

Sample Output from 3 different runs (the first shows all the error-checking):

Hiking Tracker

Number of days: 0

Invalid number of days

Number of days: -1

Invalid number of days

Number of days: 1

Day 1 distance: 255

Invalid distance

Day 1 distance: -1

Invalid distance

Day 1 distance: 0

Your total distance was   0.0km

Your average distance was 0.0km

On your final day, your distance was the same as your average.

Hiking Tracker

Number of days: 3

Day 1 distance: 12.25

Day 2 distance: 13.85

Day 3 distance: 14

Your total distance was   40.1km

Your average distance was 13.366666666666667km

On your final day, your distance was above average.

Hiking Tracker

Number of days: 2

Day 1 distance: 120

Day 2 distance: 3.1415

Your total distance was   123.1415km

Your average distance was 61.57075km

On your final day, your distance was below average.

Submission:

Submit 3 separate Python files, named as in the instructions.

DO NOT ZIP/COMPRESS YOUR FILES.

Upload your 3 separate .py files on LearnJCU (under Assessments as instructed). Submit your assignment by the date and time specified on LearnJCU.

Submissions received after this date will incur late penalties as described in the subject outline.

Integrity:

The work you submit for this assignment must be your own. Submissions that are detected to be too  similar to that of another student or other work (e.g., code found online) will be dealt with according to the College procedures for handling plagiarism and may result in serious penalties.

The goals of this assignment include helping you gain understanding of fundamental programming     concepts and skills, and future subjects will build on this learning. Therefore, it is important that you    develop these skills to a high level by completing the work and gaining the understanding yourself.     You may discuss the assignment with other students and get general assistance from your peers, but you may not do any part of anyone else’s work for them and you may not get anyone else to do any   part of your work. Note that this means you should never give a copy of your work to anyone or accept a copy of anyone else’s work, including looking at another student's work or having a classmate look at your work.

If you require assistance with the assignment, please ask general questions in the subject channel in Slack, or get specific assistance with your own work by talking with your lecturer or tutor.

The subject materials (lectures, practicals, textbook and other guides provided in the subject) contain all of the information you need for this particular assignment. You should not use online resources     (e.g., Google, Stack Overflow, etc.) to find resources or assistance as this would limit your learning    and would mean that you would not achieve the goals of the assignment - mastering fundamental     programming concepts and skills.

Assistance: Who can you get help from?

Use this diagram to determine from whom you may

seek help with your programs.

Resources: Where can you get code from? Use this  diagram to determine where you may find code to use in

your programs.

Marking Scheme:

Ensure that you follow the processes andguidelines taught in the subjectto produce high quality  work. Do not just focus on getting your code working. This assessment rubric will be applied as an average across all 3 questions for this assignment. It provides you with the characteristics of  exemplary to very limited work in relation to task criteria, covering the outcomes:

•    SLO1 - apply problem-solving techniques to develop algorithms in the IT context

•    SLO2 - apply basic programming concepts to develop solutions