Week 2 Lab submission
All lab questions focus on Python 3.0 and above versions.)
In this lab activity, your tutor will demonstrate to you how to fill the (SoftwareTestCase) inside your report, which will be used to report the test cases for your challenge activities as well as your assignment. Please make sure that you have mastered this skill and ask your tutor if you have any questions.
The following is an excellent example of writing a well-documented code, please notice the following in the code below:
1- Prologue is on the top of the code.
2- Naming convention is used.
3- Every step in the code is well-commented.
4- The code is properly indented.
Lab Activity 1:
ACME Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows:
• If a customer purchases 0 books, he or she earns 0 points.
• If a customer purchases 2 books, he or she earns 5 points.
• If a customer purchases 4 books, he or she earns 15 points.
• If a customer purchases 6 books, he or she earns 30 points.
• If a customer purchases 8 or more books, he or she earns 60 points.
A Python program that asks the user to enter the number of books that he or she has purchased this month, then displays the number of points awarded.
Lab Activity 2
Number Analysis Tool : A Python program using turtle graphics that asks the user to enter an integer. The program should display “Positive” if the number is greater than 0, “Negative” if the number is less than 0, and “Zero” if the number is equal to 0. The program should then display “Even” if the number is even, and “Odd” if the number is odd
Challenge Activity1:
Write a Python application program to input, calculate and output the following:
- Ask the user to input the following:
Customer's Name
Number of items the customer purchased
The item price
- Calculate using the following formulae:
Gross payment = Number of items * item price
goods and services tax (GST) = Gross payment * (10/100)
Net payment = Gross payment + GST
- Output the following:
Customer's Name
Number of items the customer purchased
The item price
Gross payment
GST
Net payment
For example, if the customer name is Tariq, and he purchased 13 items, and the item price is $14.72, then the calculation will be:
Gross payment = 14.72 * 13 = 191.36
GST = 191.36 *(10/100) = 17.136
Net payment = 191.36 + 17.136 = 210.496
And the program output must be as follows:
Dear Gurpreet,
You have purchased 13 items, and the item price = $14.72
Based on that, the Gross payment = $191.36 and the GST = $17.136
The Net payment you have to pay = $210.496
Please let me know if you have any question.
With best regards,
(write your name here)
Challenge Activity2:
Use the turtle graphics library to write programs that reproduce the design shown in Figure below:
- Your submission must be according to the (Lab Submission Instructions)
- You must do at least 3 test cases to demonstrate the robustness of your program.
- You must demonstrate the test results in your report according to (SoftwareTestCase)