Messages from last night
- Developing good habits for team work, no
woman is an island
- Writing readable code with proper style
- Java’s popularity, Hazelcast’s success relies
- n easy re-usability
- A lot of practice (i.e. doing bonus projects)
Messages from last night - Developing good habits for team work, no - - PowerPoint PPT Presentation
Messages from last night - Developing good habits for team work, no woman is an island - Writing readable code with proper style - Javas popularity, Hazelcasts success relies on easy re-usability - A lot of practice (i.e. doing bonus
i=0 …. …. …. …. i=1 …. …. …. …. i=2 …. …. …. …. i=3 …. …. …. ….
……..
i=50 …. …. …. ….
i++ i++
i=51 …. …. …. ….
for (int i = 1; i <= 10; i++)
for (int i = 0; i < N; i++)
for (int n = 99; n >= 1; n = n - 2)
for (int x = 1; x <= 1024; x = x * 2)
for ( init ; test ; step ) { statements to be repeated } init; while ( test ) { statements to be repeated step; }
private private GRect GRect getColoredSquare getColoredSquare(int int red red,int int green green, , int int blue blue) { ) { GRect square=new new GRect GRect(STEP STEP,STEP STEP); ); Color newColor=new new Color( Color(red red%256, %256,green green%256, %256,blue blue%256); %256); square.setColor(newColor); square.setFilled(true true); ); return return square square; }
The output is a colored rectangle
public public class class Spectrum Spectrum extends extends GraphicsProgram GraphicsProgram { public public static static final final int int APPLICATION_WIDTH APPLICATION_WIDTH = 256; = 256; public public static static final final int int APPLICATION_HEIGHT APPLICATION_HEIGHT = 256; = 256; public public static static final final int int STEP STEP = 5 = 5; public public void void run() { run() { for for(int int x=0; =0;x<getWidth getWidth(); ();x=x+STEP STEP) { ) { for for(int int y=0; =0;y<getWidth getWidth(); ();y=y+STEP STEP) { ) { GRect point=getColoredSquare(x,y, 100); add(point,x,y); } } } private private GRect GRect getColoredSquare getColoredSquare(int int red red,int int green green, , int int blue blue) { ) { GRect square=new new GRect GRect(STEP STEP,STEP STEP); ); Color newColor=new new Color( Color(red red%256, %256,green green%256, %256,blue blue%256); %256); square.setColor(newColor); square.setFilled(true true); ); return return square square; } }
CS 106A 2017 video lectures CS 106A 2008 video lectures