Code Challenges
The following can be completed at any time during the semester when you feel you are ready. Each challenge will be done with pencil and paper with our approved cheatsheet unnless otherwise stated in the particular challenge’s description.
You may also re-take any challenge with a 10%, 20%, 30% .. etc.
pentalty each
successive time. Please see below what will be required for
each challenge.
Requirements
Grade 10
Section | Must complete |
---|---|
Variables and Printing | 2 |
While Loops | 2 |
Total: | 4 |
Grade 11
Section | Must complete |
---|---|
Variables and Printing | 1 |
While Loops | 2 |
Total: | 3 |
Grade 12
Section | Must complete |
---|---|
While Loops | 1 |
Classes and Objects | 2 |
Total: | 3 |
You may be exempt from doing these. If you are working on one of our inter-class projects, you may submit a GitHub pull request link to some code you believe accomplishes the general objective described in a particular code challenge.
Variables and Printing
- You will be asked to declare two variables, assign specific values to them,
and then print out the information with a relevant message. For example:
Declare two integer variables 'x' and 'y'. Assign the value 14 to 'x' and assign the value 5 to 'y'. Print the statement "{x} is greater than {y}", except print out the values of the variables, not their name.
- You will be asked to declare variables with a variety of data types. Your program will involve printing a message and doing mathematical operations on the data.
While Loops
-
I will ask you to code a while loop that will print out all the numbers in sequence from one number to another. For example
create a while loop that prints all the numbers from 10 to 50, counting by 2
-
You will be required to create a while loop that will add (or subtract) all the numbers of a given range.
Classes and Objects
-
You will be asked to define a class with fields and instance methods based on a UML diagram. The instance methods do not have to be functional. Only the method headers will be marked.
-
You will define a class beased on a UML diagram. It will involve proper encapsulation (getters and setters) private fields fields, and instance methods. Of all the instance methods, only the getters and setters will be complete.