X Share

Java programming: Guessing games activities

Differentiation  Downloads  

Did you know that Java is used to create the majority of apps? Perhaps that’s why the team at Cambridge Assessment added Java as a programming language in the Cambridge IGCSE™ and O Level Computer Science syllabuses (0478/0984/2210). Or perhaps it’s because it’s free for anyone to use. Either way, Java continues to shape the world as we know it.

The importance of Java is something that experienced teacher and Cambridge author, Dave Duddell, knows first-hand. Dave has put this experience to good use in writing our Java Programming Book as part of our Cambridge IGCSE™ & O Level Computer Science series.

A major feature of the Java programming book is the inclusion of differentiation tasks. There are three types of task. A demo task considers a problem scenario and explains how this could be solved using a Java program. A practice task presents a problem scenario and asks the learner to write the program. A challenge task presents a more demanding scenario to the learner. Suitable example programs are provided for all of the practice and challenge tasks.

A feature of the tasks is that a scenario might be developed from chapter to chapter to include extra Java programming constructs as they are introduced. The tasks demonstrate this approach by considering a number of guessing game scenarios.

These free activities are downloadable as worksheets for your learners to try in class, or at home. The question worksheet is ideal for learners who have some experience in Java programming, this contains only the questions and so give them free range to write a program themselves. The question and example worksheet is designed for learners who are new to programming in Java. Each task is supported by an example program, helping to guide less experienced learners.

Demo Task 1

A player is asked to provide a name and then to guess a number between 1 and 10. The program must output a thank-you and the value of the number that has been stored.

The aim of the task is to demonstrate the use of variables, assignment statements and input and output. Only limited functionality is to be provided at this early stage. The answer sheet includes some example code. The Java program has been presented in a framework of object oriented features which is changed little for future example programs. The framework can be stored as a template.

 

Practice Task 1

A player is asked to provide a name and then to guess a number between 1 and 10. The program must output a thank-you and a message to say whether or not the number has been guessed correctly.

The aim of the task is to demonstrate the use of a selection statement.

 

Practice Task 2

A player is asked to provide a name and then to guess a number between 1 and 10, the player will be given 20 attempts. The program must output a message to say which number was stored and how many have been guessed correctly.

The aim of the task is to demonstrate the use of a count-controlled loop and of counting as an example of a standard method of solution.

 

Challenge Task 1

A player is asked to provide a name and then to guess a number between 1 and 10, the player will be given 10 attempts. If there is a correct guess the program is to stop and output a message to say that the number has been correctly guessed. Otherwise the program must output a sorry message.

The aim of the task is to demonstrate the use of a condition-controlled loop and of the use of a Boolean variable to control the loop.

Looking for more? Download free differentiation activities from ICT author Evans Chikasa.

Go back
X Share