1 of 12

To do: October 15

Suppose we have the following classes:

· High School Student, Teacher, Student, Person, College Student

On the whiteboard, draw a hierarchy of the classes showing the relationships among the classes in the space below.

The connectors between classes should be arrows, with the head of the arrow pointing towards the superclass.

2 of 12

Go over homework

  • Complete Inheritance Review worksheet and submit to Hub
  • CSAwesome 9.1-9.3 Inheritance Review part 1 - readings and exercises

3 of 12

Recall this problem...

Suppose we have a 60 ft by 100 ft rectangular room and we want to cover the floor with square tiles completely without gaps nor overlapping.

We also want to use the smallest number of square tiles possible. What will be the size of the square tiles?

What is the mathematics significance of the dimensions of the square tiles?

4 of 12

Recall this problem...

Suppose we have a 60 ft by 100 ft rectangular room and we want to cover the floor with square tiles completely without gaps nor overlapping.

We also want to use the smallest number of square tiles possible. What will be the size of the square tiles?

What is the mathematics significance of this dimensions of the square tiles? The greatest common factor of the dimensions: 60 and 100.

5 of 12

GCD

6 of 12

GCD

a,b positive integers, a > b

GCF (a,b) = GCF(b, a%b)

7 of 12

GCD

Find the greatest common divisor of a = 315 and b = 168.

How can we visualize this problem?

8 of 12

GCD

Find the greatest common divisor of a = 315 and b = 168.

How can we visualize this problem?

Example: a = 1071 and b = 462 at https://en.wikipedia.org/wiki/Euclidean_algorithm

9 of 12

GCD

Find the greatest common divisor of a = 1071 and b = 462.

How can we visualize this problem? https://en.wikipedia.org/wiki/Euclidean_algorithm

Assuming a > b:

GCD(a,b) == GCD(b,a%b)

Loop until a%b==0. b is the GCD.

10 of 12

Repl.it lab - gcd

linear (brute force) vs Euclidean (recursive and iterative)

11 of 12

Troop and Dinosaur class worksheet

12 of 12

Homework due Friday

  • Complete Inheritance - Troop and Dinosaur worksheet and submit to Hub
  • Complete Repl.it lab 04-01 gcd