编程代写|Programming Assignment 1 (CSE4IP S2, 2022)
这是一篇来自澳洲的关于编程分配解决方案的编程代写
Instructions
This assignment is structured similarly to the labs, and as such the instructions are similar:
Read each question thoroughly multiple times to ensure that you understand the requirements.
Once you understand the question, code your solution in the associated code cell titled “Your Solution”.
Test your solution multiple times, with a variety of inputs—not just those found in the example runs.
Unless explicitly asked in the question, you are not required to validate user input, i.e. you can assume that the user will enter a valid input value.
Keep in mind that partial attempts at solutions will likely still be worth some marks, so be sure to have a go at writing code for every task.
When you have satisfactorily attempted all problems, con¦rm that your solution works by resetting the notebook runtime and running your code again—instructions can be found at the bottom of this notebook.
The submission for this assignment is the .ipynb notebook ¦le. You should export this ¦le and upload it via the link in the LMS—instructions can be found on the assignment submission page. Do not submit your solutions in any other format as they will not be graded.
This is an individual assignment, and the solutions that you submit for all of the tasks must be your own. Copying solutions from other students, relatives, friends, or strangers on the internet is plagiarism and treated as academic misconduct by La Trobe University. Plagiarism includes copying solutions and making super¦cial changes to the code (such as renaming variables or editing comments). The penalty for academic misconduct can be as serious as expulsion from the university.
Frequently Asked Questions
Q: I want to write the code in a text editor such as Visual Studio Code. Can I submit .py ¦les instead of using this notebook?A: No, only .ipynb ¦les will be graded. If you really want to write your code in a text editor,ensure that you copy your solutions into the appropriate notebook cells afterwards and run them to make sure that they work correctly. You can then follow the usual submission procedure.
Q: I’m getting ready for submission, but I can’t open the downloaded .ipynb ¦le on my computer. Is that a problem?
That’s not a problem, we know how to open it to mark your assignment. If you want to double check the contents of the downloaded .ipynb ¦le for your own peace of mind, you can upload it to Google Colab and open it there.
Q: There is a mismatch between the precision of values shown in the example runs and my solution’s output (e.g. my code prints “$5588.2219172490795” but the example run shows “$5588.221917249078”). Is it still possible to achieve full marks with this kind of discrepancy?
A: Yes, you will not be penalised for this kind of discrepancy in Programming Assignment 1. As long as §oating point numbers are displayed with a decimal part, the exact number of decimal places shown is not strict for this assignment. These requirements will be stricter in
Programming Assignment 2.
This assignment consists of ¦ve programming tasks, with a total of 100 marks allocated between them according to their di¨culty.
Take your time to read and re-read the instructions before attempting to write your solution—you can save a lot of trouble by simply having a clear understanding of the problem before touching any code.
Programming Tasks
For this task, you are to write code for the following numerical expression.
Task 1 (20 marks)
Write a simple Python program which asks the user to input a value for , and , and then prints the result of the following mathematical expression ( ):
Instructions
x y z ff = (+ 1(x−0.5)∗y/√1
+ (1 + y ∗ xz))
∗+ 4 + 1 −(z +1)/√zy1
You should replace
x by x ** 0.5√−
You must keep the calculation as a single expression on a single line in your ¦nal solution.
You must not rearrange or simplify the expression in any way.
You should parentheses in code so that it is evaluated in the same way as the mathematical expression described above.
You must not use any conpcets not covred yet
Requirements
Enter a value for x: 5
Enter a value for y: 3
Enter a value for z: 3
f = -7613.484692283496
Enter a value for x: 1
Enter a value for y: 1
Enter a value for z: 1
f = 20.071067811865476
Enter a value for x: 100
Enter a value for y: 1
Enter a value for z: 2
f = 47377.17423586197
Example Runs
Your Solution
x = float(input(‘Enter a value for x: ‘))
y = float(input(‘Enter a value for y: ‘))
z = float(input(‘Enter a value for z: ‘))
f = (((((x-0.5)*y)**0.5+1)/1)+(1+y**z))*((z+1)**0.5+4+1-z**y)/1
print(‘f = ‘ + str(f) )
Enter a value for x: 1
Enter a value for y: 2
Enter a value for z: 3
f = -22.0For this task, you are to write code that computes the value of acceleration of object, given the values of displacement, time, and initial velocity.
Task 2 (15 marks)
For this task, you are to write code that computes the value of acceleration of object, given the values of displacement, time, and initial velocity.
Instructions
Your program should ask for user inputs to get the values of displacement (how much distance the object has travelled), time, and the initial velocity of the object. It should then calculate the acceleration of the object and print this value out.
Here is a §owchart which illustrates the expected program §ow: