// PROBLEM FOR THIS WEEK: This problem has two parts: // (i) Type this program in a file, compile and execute. While executing, // it will ask for a number. Type any number and click ok. It will show two // cocentric circles. // (ii) Now replace the last 4 instructions by another set of instructions // which draw the shape asked for. import javabook.*; import java.awt.*; class Shape { public static void main (String[] arg) { // Create an object of class DrawingBoard and invoke its setVisible method // so it becomes visible on the screen. DrawingBoard board = new DrawingBoard(); board.setVisible(true); // following 3 instructions do not do any thing useful for this program. // They are added so that shape drawing instructions are executed only // after DrawingBoard become visible on the screen. These instructions // ask the user to enter a number which is never used. // Please ask for a detailed explanation about this in the lecture. MainWindow mainWindow = new MainWindow(); InputBox inputBox = new InputBox(mainWindow); inputBox.getInteger("give an integer"); // **************SHAPE DRAWING INSTRUCTIONS ******************** // The following instructions draw two cocentric circles of different // colours. Replace them by a new set of instructions which draw a BICYCLE. // Try to make it look as real as possible. // For more methods of class DrawingBoard visit the course website, // click on "Text & References". Then click on "Documentation" of "javabook" // which is the package where class DrawingBoard is defined. board.setColor(Color.cyan); board.drawCircle(200,200,100); board.setColor(Color.red); board.drawCircle(200,200,150); } }