Gr All – Generate random

Being able in Java to generate a random, from an arbitrary number, to another arbitrary number (from lower bound to upper bound). This program generates 20 random numbers to ensure that both the upper bound and the lower bound feature in the solution. Here is the...

read more

Gr 12 – Date/time format

There are times when you need to present a stored value in a different format . . .  Real number example -  8.987578. Here you may prefer to say 8.99 Date example - "2018-1-1". Here you may prefer to say "1 January 2018" Java has a number of String formatting methods...

read more

Gr 11 – Date and time

We can use String for simple date-time tasks ie 23/05/2021 - we can use String methods like substring to extract information like date, month and year. When we need the current data and time from the system clock, or we need to do date/time arithmetic, we need...

read more

Gr 10,11,12 – Pause

There are times when we wish our Java code would run a lot slower e.g. when we want to count down from 10 to 0 with 1-second intervals. Here we can use "Thread.sleep(milliseconds)" see line 22 below. Note that the sleep period is not precise as your computer is...

read more

Gr 11 – Bare Bones 3 Class

Java - Three class template. In the grade 11 exam you are expected to write applications with at least three classes i.e. A UI class. Creates the manager class. Calls the methods it needs. May have some input and output. A manager class for all your methods. A...

read more