CSIT110/CSIT810 Solved

$ 24.99
Category:

Description

– Able to write clear code with comments and follow coding convention
– Able to use variables with meaningful names and correct data types
– Able to define functions and class objects Marking criteria:
– Total mark is 10. Deduct 1 mark for each day late.
– More than 3 days late will result in a zero mark.
– Code must be able to run with no errors: 0 mark for the whole assignment if there is an error is thrown.
– Correct file format (.py extension): 0 mark for the whole assignment if file submission is not in correct format.
– Use submission template for file submission.

Question 1 correctness, completeness and consistency with the assignment specification 2.5 marks
Question 2 correctness, completeness and consistency with the assignment specification 2.5 marks
Question 3 correctness, completeness and consistency with the assignment specification 2.5 marks
Question 4 correctness, completeness and consistency with the assignment specification 2.5 marks
Overall comments include name, student number, subject code; clear code and follow coding convention; use variables with meaningful names and correct data types Deduct up to 1 mark

Submission Instruction: Assignment 2 submission is on Moodle. Put all your python code into a single python file (file extension .py) and submit it.
Save the file in this format name_uowID_a2.py

Assignment questions: there are 4 assignment questions.
Write clear code with comments and follow coding conventions. Comments should include your name, student number and subject code on top of your code. Please also add this information to the variables as stated in the template Your code must work exactly like the provided examples given the input in the examples.

name = ‘John Snow’
student_num = ‘1234567’ # Student number subject_code = ‘CSIT110’ # CSIT110 or SP121

Question 1. Write a function that satisfies the following specifications.

Function name question_1
Detailed information Write a program to take in the following input.
Treat the first 2 inputs as str objects
Treat the last input as an int object

Let N be the number given in the last user input.
Display a string with the following content – a string containing N number of the first string object, and each of them are separated by the second string object.
Do not use string concatenation or f-string.
Use the end parameter in the print function to display the string object. There should be a newline at the end of the string.

Example console output prompt1 hava prompt2 na prompt3 4 havanahavanahavanahava

Question 2. Write a function that satisfies the following specifications.
Function question_2
Parameters –
Return Value –
Detail Information Get user inputs for an upper bound number and a gap number with the prompts shown in the example.
The upper bound number is a non-negative integer and the gap is a positive integer.
The program displays numbers from 0 to the upper bound, and from upper bound down to 0. The gap between two consecutive numbers must be correct according to the user input. Your program must work exactly like the following example (the text in bold indicates the user input)

Your program does not have to handle error cases when ● upper bound < 0.
● gap <= 0
You should test your program for different kind of scenarios, here are some examples for testing:
○ Upper bound = 5, gap = 1: results 0, 1, 2, 3, 4, 5. sum=15, and 5, 4, 3, 2, 1, 0. sum=15.
○ Upper bound = 5, gap = 2: results 0, 2, 4. sum=6 and 5, 3, 1.
sum=9.
○ Upper bound = 5, gap = 7: results 0. sum=0 and 5. sum=5.
○ Upper bound = 15, gap = 7: results 0, 7, 14. sum=21 and 15, 8, 1. sum=24.

Ther Upper bound = 0, gap = 1: results 0. sum=0 and 0. sum=0.
e is a space after every colon.
Example console output Enter upper bound: 20
Enter gap: 3
Go forward: 0, 3, 6, 9, 12, 15, 18.
Sum of numbers = 63
Go backward: 20, 17, 14, 11, 8, 5, 2. Sum of numbers = 77

Question 3. Write a function that satisfies the following specifications.
Function question_3
Parameters –
Return Value –
Detail Information This function computes the total interest earned for a given year based on the following rated.
Base Interest:
Ordinary Account (OA): 2.5% per annum.
Special Account (SA): 4% per annum.
Medisave Account(MA): 4% per annum.
Retirement Account(RA): 4% per annum (only applicable for those age 55 and above.)
Extra Interest:
Age Extra interest (capped at $20,000 for
OA)*
Below 55 years old 1% per annum on the first $60,000
55 years old and above 2% per annum on the first $30,000, 1% per annum on the next $30,000
* OA contributes a maximum of $20000 to the extra interest calculation.
Using the prompts shown in the example, calculate and display the interest earned for in one year assuming no money was deposited into the account during that period.
You do not have to round the interest up or down.

You should test your program for different kind of scenarios, here is another example for testing:
35, 30000, 10000, 20000 -> $2450.00

Example 1 console output Enter current age: 35
Enter current amount in OA: 10000
Enter current amount in SA: 10000
Enter current amount in MA: 10000
Your interest rate this year will be $1350.00
Example 2 console output Enter current age: 65
Enter current amount in OA: 10000
Enter current amount in SA: 10000
Enter current amount in MA: 10000
Enter current amount in RA: 10000
Your interest rate this year will be $2150.00

Question4. Write a function that satisfies the following specifications.
Function Name question_5
Detailed
Information
Tim downloaded a large number of poorly named files, e.g.
“patient_zero[20150203].txt”, “[shn]shn_batch101.csv”,
“[x264]psa_recording[1280×720].mp4”
and would like to automatically clean up these filenames by removing all instances of square brackets and the contents contained within.

1. Prompts for filenames with “Filename?” repeatedly, until an empty string is given
2. Prints a string with all the cleaned filenames, separated by commas, without any spaces between.

Example Console output Filename?patient_zero[20150203].txt
Filename?[shn]shn_batch101.csv
Filename?[x264]psa_recording[1280×720].mp4
Filename?
patient_zero.txt,shn_batch101.csv,psa_recording.mp4

Reviews

There are no reviews yet.

Be the first to review “CSIT110/CSIT810 Solved”

Your email address will not be published. Required fields are marked *