You are on page 1of 4

Week-1 Teaching A level Computer Science OOP Activities

Activity1:
2. Explain why strings in Python could be considered as a
built-in object using an example.

3. For your Staff() class we would like staff address to be


included. Extend your original code to include this attribute.
4. Change the method greet() to staff_details and print
staff_details.
5. Create a method to calculate salary of staff by including
number of hours they worked times staff rate per hour which is
£30.
6. Add bonus £150 to staff who have worked more than 28 hours.
Bonus must be included in their salary.

1|Page
Activity 2:
1. Table below shows the costs for Pizza.
Pizza_Choice Small Medium Large
Cheese & £8.99 £10.99 £12.99
Tomato
Ham & £8.99 £10.99 £12.99
Mushroom
BBQ Chicken £8.99 £10.99 £12.99
Hawaiian £8.99 £10.99 £12.99
Pepperoni £8.99 £10.99 £12.99
Mexican £8.99 £10.99 £12.99
Chicken
Vegetarian £8.99 £10.99 £12.99
Vegetarian £8.99 £10.99 £12.99
Hot

Here is the start to our Pizza class, type this code and save it.

1. Give examples of attributes for class Pizza


…………………………………………………………………………………………………………………………………………………………………………
2. What is the purpose of pizza_cost=0.0 in the __init__ method ?

3. Now we are going to include customer2 object information


(“Scott”,”Vegetarian”,12) and call the method displayorder().
pizza_size is an int not a string datatype so do you think it
will print the customer2 information?
Your predicted result …………………………………………………………………………………….
Now run the program and compare whether it matches your result

Activity 3:

2|Page
Continuing on from activity 2 we have added a new method cost()

1) Complete typing the cost() method and calling customer1.cost()


and customer2.cost() before displayorder() method. Why do you think
cost() method is called before displayorder() method?

2) After completely typing the code run the program. Does your
program run properly if not what do you think is the problem? Debug
the code.

3) What do you think will be the total for customer2’s order? Do you
think it has been calculated correctly? If not give your reasons.

Activity 4:

3|Page
1. If a customer chooses “yes” for toppings then an additional cost
of £2.50 is included in total. Amend this information to Pizza
class.
2. Orders over the total cost of £12 are eligible for free delivery
but if not an addition £2.00 is added to the total cost.
3. On weekends Pizza prices are increased by 1.50 for pizza of all
sizes. Include this information when calculating total.

4|Page

You might also like