首页 » Python代写 » Python代写|CP1401/CP5639 2022 TR1 Assignment 1

Python代写|CP1401/CP5639 2022 TR1 Assignment 1

这是一篇来自澳洲的关于使用Python实现3个独立的程序的Python代写

3个程序任务为:1.Pay Calculator:输入、处理和输出  2.Space Cadet Results:决策结构  3.Sleep Tracker:重复性结构

 

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.
  1. 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.

  1. 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.

  1. 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.
  1. 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.
  1. 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 – Pay Calculator:

Learning outcome focus: Input, Processing, Output

File name: a1_1_pay_calculator.py

At Experience Counts, workers get paid based on their level of experience.

Write a program that asks an employee for their number of hours worked and experience level, then displays how much their total pay will be.

There is no limit to an employee’s experience level and no error-checking is required.

The base pay for experience level 0 is $45.00

Each level of experience gives 5% more pay, so experience level 1 is $47.25; experience level 3 is 15% more than the base, or $51.75, etc. You should write your program so that if the base pay were to change, the programmer would only need to change it in one place (that’s what constants are for).

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

Sample Output from 3 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 10 and 3. All of the other parts of the sample were

printed by the program.

Experience Counts Pay Calculator

Number of hours worked: 10

Experience level: 3

Based on your experience level (3):

Your hourly pay rate is $51.75

Your total pay is $517.50

Experience Counts Pay Calculator

Number of hours worked: 40

Experience level: 99

Based on your experience level (99):

Your hourly pay rate is $267.75

Your total pay is $10710.00

Experience Counts Pay Calculator

Number of hours worked: 0

Experience level: 52

Based on your experience level (52):

Your hourly pay rate is $162.00

Your total pay is $0.00

 

Program 2 – Space Cadet Results:

Learning outcome focus: Decision Structures

File name: a1_2_space_cadet.py

This program helps determine the fate of trainee space cadets.

Users can enter scores for their practical work and their exam (each expected between 0 and 50).

The system then determines their results as follows:

Trainees fail if their total score is under 50.

If trainees do not fail, then they either become:

– a field agent, if their practical score is greater than or equal to their exam score

– a desk officer, if their exam score is greater than their practical score

If a trainee’s total score is 90 or greater, they make the honour roll.

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

Sample Output from 3 different runs:

Welcome Trainee Space Cadet. How did you do?

Practical score (0-50): 24

Exam score (0-50): 25

Your total score is 49 out of 100.

You failed. Please try again next year.

Welcome Trainee Space Cadet. How did you do?

Practical score (0-50): 39

Exam score (0-50): 23

Your total score is 62 out of 100.

You will become a field agent.

Welcome Trainee Space Cadet. How did you do?

Practical score (0-50): 44

Exam score (0-50): 46

Your total score is 90 out of 100.

You will become a desk officer.

Congratulations on making the honour roll!

 

Program 3 – Sleep Tracker:

Learning outcome focus: Repetition Structures

File name: a1_sleep_tracker.py

A “sleep debt” represents the difference between a person’s desirable amount of sleep and how long they actually sleep for. Write a program that prompts the user to enter how many hours they slept each day over a work-week period of 5 days, then informs them of their sleep debt status.

Using 8 hours per day as the desirable amount of sleep, determine their sleep debt by calculating the total actual hours of sleep and subtracting that from the total desirable hours of sleep.

Display results messages as demonstrated below.

Note that in this program, you must use an error-checking loop to ensure that the user’s inputs are within the range 0-24 inclusive.

As with the other programs, you should think about using CONSTANTS to make it easy (in one place) to change the program, such as calculating sleep debt for a period of 7 days instead of 5.

With (next to) your pseudocode for this question, include a brief justification/explanation of which repetition pattern(s) you chose to use and why.

Sample Output from 2 different runs:

Sleep Tracker

Night 1 hours sleep: 7.5

Night 2 hours sleep: -3

Invalid number of hours.

Night 2 hours sleep: 25

Invalid number of hours.

Night 2 hours sleep: 0

Night 3 hours sleep: 8.75

Night 4 hours sleep: 6

Night 5 hours sleep: 7

Recommended total sleep is: 40

Your total hours of sleep : 29.25

Your sleep debt over this time is: 10.75

Sleep Tracker

Night 1 hours sleep: 8

Night 2 hours sleep: 8

Night 3 hours sleep: 8

Night 4 hours sleep: 8

Night 5 hours sleep: 8

Recommended total sleep is: 40

Your total hours of sleep : 40.0

You are getting enough sleep. Keep it up!


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。