IB Computer Science Unit 1
IB Computer Science Unit 2
IB Computer Science Unit 3
IB Computer Science Unit 4
IB Computer Science Unit 5
IB Computer Science Unit 6

IB Computer Science Problem Solving Part 1

IB Computer Science Learning Goals

In this IB Computer Science lesson you will be learning about:

  • Use Simple Math to Solve Problems
  • Think Sequentially about how a computer executes code

How to write code that solves a problem

It is a lot easier to write programs when you take a few minutes and think ahead of time of the process that needs to happen to solve the problem.

Let’s take a very simple example:

You want to write a program that calculates the area and perimeter of a rectangle.

Before you write the code you need to actually know how you would go about solving that problem if you didn’t have a computer

IB-Computer-Science-Problem-Solving-Intro (1)

Maybe even writing out an example to show how it works would be helpful.

IB-Computer-Science-Problem-Solving-Intro (2)

Once you figured out how to solve the problem, you need to start thinking about how to get the computer to do the same thing.

We need to be able to have the user enter in values from the keyboard

  • These values will need to be stored in variables, so start to think about what variables are needed and what types of values they need to store
  • It looks like in our example that all the values are going to be integers and we will need 4 variables to represent the length, width, area, perimeter

We need to be able to perform some simple math calculations

  • A mathematical operator is an instruction that tells you what to do with two or more numbers. You have been using operators in math since you started school. They are the addition, subtraction, multiplication, and division. They are each given a symbol in Java

    • Addition +
    • Subtraction –
    • Multiplication *
    • Division /
  • Calculations are performed Left to Right and Java will follow the rules of BEDMAS. If you wish to use brackets, you must use ( ) not [ ] or { }
  • In order to do mathematical calculation you perform a calculation and then assign the result of that calculation to a variable.
  • Then use that variable however you wish afterwards.

A complete program

IB-Computer-Science-Problem-Solving-Intro (1)

IB Computer Science Practice Questions

1. Write a program that finds the volume of a triangular based pyramid given its height along with the base and height of the triangle base.

2. Write a java program that takes a subtotal of a purchase, calculates the tax (13%) and the final price.

Looking to Learn More about Computer Science and Coding?

Check out our programing in python courses that focus on high school level coding.  

  • Grade 11 Computer Science ICS3U
  • Grade 12 Computer Science ICS4U

These courses are complete with interactive coding lessons, teacher led videos, and more practice questions with complete solutions

Return To International Baccalaureate Computer Science Main Page